
Roslyn diagnostics in the alpha VS Code extension.
Diagnostics
SharpLsp routes C# compiler errors, warnings, and Roslyn analyzer diagnostics through the C# sidecar. The current website shows the VS Code extension state; F# diagnostics are still in progress.
How It Works
Editor ββ Rust LSP Host ββ C# Sidecar
β β β
Problems publishDiagnostics Roslyn
window notifications GetDiagnostics()
- Document change β editor sends
textDocument/didChange, Rust host updates VFS and tree-sitter - Debounce β changes are coalesced over a 150ms window (configurable)
- Dispatch β Rust host sends a
workspace/diagnosticsrequest to the C# sidecar - Analysis β Roslyn runs full semantic analysis on the affected scope
- Publish β results are mapped to LSP
Diagnosticobjects and pushed to the editor
Note: Diagnostics are currently C# only. F# diagnostics via FCS are not yet implemented.
Analysis Scope
| Mode | Default | Description |
|---|---|---|
| Solution-wide | β | All documents in all loaded projects |
| Open files only | β | Only documents currently open in the editor |
| Per-project filter | β | Specific projects matched by name pattern |
Solution-wide analysis is part of the SharpLsp direction. The alpha extension is still being hardened, so treat diagnostics behavior as active development rather than a beta stability guarantee.
Diagnostic Categories
Compiler Diagnostics
| Language | Examples |
|---|---|
| C# (Roslyn) | CS0029 (type conversion), CS0246 (type not found), CS8600βCS8798 (nullable) |
Analyzer Diagnostics
- Built-in Roslyn analyzers β IDE0001βIDE0090, CA1000βCA2000 code quality rules
- .editorconfig rules β code style enforcement mapped from
.editorconfigseverity - Third-party NuGet analyzers β StyleCop, SonarAnalyzer, and any
<Analyzer>reference
Live Squiggles
Diagnostics are pushed in three situations:
- On document change β re-analysis after the debounce window
- On project change β re-analysis when
.csproj/.fsprojchanges - On solution load β full solution scan, streamed incrementally
Configuration
# sharplsp.toml
[diagnostics]
# Run Roslyn analyzers (not just compiler errors)
analyzers_enabled = true
# Analyze all files in the solution, not just open ones
solution_wide_analysis = true
# Restrict analysis to specific projects by name (empty = all)
project_filter = []
Project Filter
Narrow the scope for large monorepos:
[diagnostics]
project_filter = ["MyApp.Core", "MyApp.Api"]
Performance Targets
| Metric | Target |
|---|---|
| Single file refresh | <500ms from keystroke |
| Solution-wide initial scan | <10s for 50-project solution |
| Incremental re-analysis | <1s after single file edit |
| Memory overhead (solution-wide) | <200MB for 50 projects |
Severity Mapping
| Roslyn / FCS Severity | LSP Severity |
|---|---|
| Error | 1 β Error |
| Warning | 2 β Warning |
| Info | 3 β Information |
| Hidden | 4 β Hint |