diff --git a/docs/plans/DIAGNOSTICS-STATIC-ANALYZERS-PLAN.md b/docs/plans/DIAGNOSTICS-STATIC-ANALYZERS-PLAN.md
index 35a1ce54..a1f6441f 100644
--- a/docs/plans/DIAGNOSTICS-STATIC-ANALYZERS-PLAN.md
+++ b/docs/plans/DIAGNOSTICS-STATIC-ANALYZERS-PLAN.md
@@ -20,14 +20,16 @@ Implements [ANALYZERS-MONOREPO-GATE] and [ANALYZERS-SOLUTION-SCOPE].
TOML strictness.
- [ ] Update `src/examples/config/sharplsp.example.toml` through a TOML parser/serializer, not line
splicing.
-- [ ] Hot-reload workspace/static-analyzer config through
- `workspace/didChangeConfiguration`.
+- [x] Hot-reload workspace/static-analyzer config through
+ `workspace/didChangeConfiguration` (shipped as `[analyzers] dead_code`/`monorepo`) — `configuration_live.rs` `reconfigure`;
+ e2e `analyzer_settings_from_the_editor_or_the_file_apply_to_the_next_pull` (editor and on-disk edits).
- [ ] Bump `global_state_version` and send `workspace/diagnostic/refresh` when
monorepo/static-analyzer settings change.
- [ ] Full-stack test: default config produces no unused-public-code
diagnostics.
-- [ ] Full-stack test: `repository_kind = "standard"` suppresses the analyzer
- even when `unused_public_symbols = true`.
+- [x] Full-stack test: `repository_kind = "standard"` suppresses the analyzer
+ even when `unused_public_symbols = true` (shipped as `[analyzers] dead_code`/`monorepo`) — same e2e, step 2: `dead_code` on,
+ no monorepo, the public F# function is not reported.
- [ ] Full-stack test: `repository_kind = "monorepo"` enables the analyzer only
when `solution_wide_analysis` and `analyzers_enabled` are also true.
@@ -63,10 +65,12 @@ Implements [ANALYZERS-DIAGNOSTICS], [ANALYZERS-PERFORMANCE], and
Implements [ANALYZERS-UNUSED-PUBLIC], [ANALYZERS-REFERENCE-MODEL], and
[ANALYZERS-SUPPRESSION] for C#.
-- [ ] Build a Roslyn candidate collector from `ISymbol` data for public API
- surface.
-- [ ] Use `SymbolFinder.FindReferencesAsync` to count non-declaration references
- across the loaded solution graph.
+- [x] Build a Roslyn candidate collector from `ISymbol` data for public API
+ surface — `DeadCodeAnalyzer.cs` `IsCandidate`/`Visibility`; `DeadCodeAnalyzerTests`
+ `Monorepo_reports_unused_public_symbols_as_errors`.
+- [x] Use `SymbolFinder.FindReferencesAsync` to count non-declaration references
+ across the loaded solution graph — `SearchScope.cs`; `DeadCodeAnalyzerTests`
+ `Types_referenced_only_through_members_are_not_flagged`.
- [ ] Count inheritance, interface implementation, overrides, attributes,
construction, invocation, and member access as uses.
- [x] Roll member uses from outside a type up to the type (extension calls, static
@@ -81,13 +85,14 @@ Implements [ANALYZERS-UNUSED-PUBLIC], [ANALYZERS-REFERENCE-MODEL], and
list from the spec.
- [ ] Emit `SLSPC0101` diagnostics with source `sharplsp-static-csharp`,
severity Information, and tag `Unnecessary`.
-- [ ] Full-stack test: unused public C# type in a monorepo solution is reported.
+- [x] Full-stack test: unused public C# type in a monorepo solution is reported —
+ `configuration_live.rs` `csharp_unused_public_types_are_dead_only_in_a_monorepo`, step 2.
- [ ] Full-stack test: public C# type referenced by another project is not
reported.
- [ ] Full-stack test: public C# member used by reflection/framework attribute is
suppressed.
-- [ ] Full-stack test: non-monorepo config reports no C# unused-public-code
- diagnostics.
+- [x] Full-stack test: non-monorepo config reports no C# unused-public-code
+ diagnostics — same test, steps 1 and 3: only the internal type is reported.
## Phase 4: F# Unused Public Symbols (P0)
@@ -98,8 +103,9 @@ Implements [ANALYZERS-UNUSED-PUBLIC], [ANALYZERS-REFERENCE-MODEL], and
functions, members, union cases, record fields, active patterns, delegates,
and interfaces.
- [ ] Treat `.fsi` signature files as the public-surface authority when present.
-- [ ] Use FCS symbol-use APIs to count non-declaration references across all F#
- projects in the loaded solution graph.
+- [x] Use FCS symbol-use APIs to count non-declaration references across all F#
+ projects in the loaded solution graph — `FSharpAnalyzers.fs` `deadCodeDiagnostics`;
+ `SidecarEndToEndTests.fs` (referenced bindings never flagged).
- [ ] Count pattern matching, union-case construction, record construction/update,
active-pattern use, member access, and interface/override binding as uses.
- [ ] Suppress nested-member cascades when the containing public module/type is
@@ -110,14 +116,14 @@ Implements [ANALYZERS-UNUSED-PUBLIC], [ANALYZERS-REFERENCE-MODEL], and
implicit-use attributes.
- [ ] Emit `SLSPF0101` diagnostics with source `sharplsp-static-fsharp`,
severity Information, and tag `Unnecessary`.
-- [ ] Full-stack test: unused public F# function in a monorepo solution is
- reported.
+- [x] Full-stack test: unused public F# function in a monorepo solution is
+ reported — `configuration_live.rs` step 3: `unusedPublic` reported as an error.
- [ ] Full-stack test: public F# value referenced by another project is not
reported.
- [ ] Full-stack test: `.fsi` public-surface declarations receive diagnostics at
the signature declaration where possible.
-- [ ] Full-stack test: non-monorepo config reports no F# unused-public-code
- diagnostics.
+- [x] Full-stack test: non-monorepo config reports no F# unused-public-code
+ diagnostics — `configuration_live.rs` step 2: only the private helper is reported.
## Phase 5: Cross-Language References (P1)
@@ -138,8 +144,10 @@ Implements the cross-language part of [ANALYZERS-REFERENCE-MODEL].
unopened files after `workspace/diagnostic`.
- [ ] VS Code e2e test: changing `repository_kind` triggers
`workspace/diagnostic/refresh` and removes/adds diagnostics.
-- [ ] Add code descriptions for `SLSPC0101` and `SLSPF0101` that link to the
- static analyzer docs.
+- [x] Add code descriptions for `SLSPC0101` and `SLSPF0101` that link to the
+ static analyzer docs — `RuleDocumentation.cs` (Common) points both at the website's
+ Diagnostics › Dead code section; `DeadCodeAnalyzerTests` and `FSharpAnalyzersTests`
+ assert the link, and that `SLSPF0102` carries none.
- [ ] Add future code action stubs using `Diagnostic.data`: suppress diagnostic,
reduce visibility, and safe delete.
- [ ] Add performance regression fixture for a mixed 50-project solution.
diff --git a/docs/plans/DISTRIBUTION-PLAN.md b/docs/plans/DISTRIBUTION-PLAN.md
index c96c2b90..3fb26793 100644
--- a/docs/plans/DISTRIBUTION-PLAN.md
+++ b/docs/plans/DISTRIBUTION-PLAN.md
@@ -131,7 +131,7 @@ CLAUDE.md mandates hierarchical IDs (`[GROUP-TOPIC]`), uppercase, hyphen-separat
- [x] `tools/audit/dotnet-vulnerable.mjs` fails the .NET leg (dotnet list exits 0 on findings) + tests in `make _test-tooling`
- [x] `ci-audit.yml` runs `make audit` on every PR (`ci.yml`), weekly on `main`, and as a release gate (`release` needs `audit`)
- [x] Include `audit` in the final CI job's dependencies; YAML-based regression tests guard both CI and Marketplace/Open VSX release enforcement.
-- [ ] Upgrade `@vscode/test-cli` once a release drops mocha 11 (its nested `diff` 7.0.0 carries low-severity GHSA-73rr-hh4g-fpgx)
+- [x] Upgrade `@vscode/test-cli` once a release drops mocha 11 (its nested `diff` 7.0.0 carries low-severity GHSA-73rr-hh4g-fpgx) — the tree now resolves `mocha` 12 with `diff` 9.0.0 (`npm ls diff`), and `npm audit` reports 0 vulnerabilities at every severity
## TODO Checklist — original v0.1.0 work (status snapshot)
diff --git a/docs/plans/RIDER-PLUGIN-PLAN.md b/docs/plans/RIDER-PLUGIN-PLAN.md
index 2f0c390a..8f2232fd 100644
--- a/docs/plans/RIDER-PLUGIN-PLAN.md
+++ b/docs/plans/RIDER-PLUGIN-PLAN.md
@@ -173,14 +173,19 @@ only — Community editions are not supported.
### Phase 7: Build infrastructure
-- [ ] Add `build-rider` Makefile target — calls `./gradlew buildPlugin`
+- [x] Add `build-rider` Makefile target — calls `./gradlew buildPlugin`
and copies the zip to `dist/sharplsp-rider.zip` — **but only if**
- the environment has a JVM; otherwise skip with a warning
-- [ ] Add `package-rider` Makefile target — alias for `build-rider` for
- naming symmetry with `package-zed`
-- [ ] Add `test-rider` Makefile target — `./gradlew test`
-- [ ] Add `lint-rider` Makefile target — `./gradlew check`
-- [ ] Add `clean-rider` Makefile target — `./gradlew clean`
+ the environment has a JVM; otherwise skip with a warning — as the private `_build-rider` leg of `make build`: the Makefile's twelve public targets are its whole surface.
+ `tools/rider/gradle.sh` finds a JDK 21+, and records a skipped-leg marker when there is none
+- [x] Add `package-rider` Makefile target — alias for `build-rider` for
+ naming symmetry with `package-zed` — `_build-rider` IS the packaging step, as `_build-zed`
+ is Zed's; neither editor has a public package target
+- [x] Add `test-rider` Makefile target — `./gradlew test` — `_test-rider` (Kover report and
+ coverage gate), a leg of `make test`
+- [ ] Add `lint-rider` Makefile target — `./gradlew check`. Open: no Kotlin linter is
+ configured and `check` reruns the test suite; needs a decision on detekt/ktlint or
+ `allWarningsAsErrors` before `make lint` can cover the plugin
+- [x] Add `clean-rider` Makefile target — `./gradlew clean` — `_clean-rider`, a leg of `make clean`
- [x] Wire Rider build into the top-level `build` target (`_build-rider`)
- [x] Wire Rider tests into the top-level `test` target (`_test-rider`)
- [x] Update README `Install` section with a one-paragraph Rider block
@@ -214,8 +219,10 @@ how it was installed — and CI built and coverage-gated it in that state.
### Phase 9: CI
-- [ ] Add `build-rider` + `test-rider` to `.github/workflows/ci.yml`
- under a matrix job that requires JDK 17
+- [x] Add `build-rider` + `test-rider` to CI — the reusable workflows of [DIST-CI-LAYOUT]:
+ `ci-build.yml` `build-rider` and `ci-test-editors.yml` `test-rider` (`RIDER_REQUIRED=1`),
+ both through `.github/actions/rider-environment` on JDK 21, which the current Rider SDK
+ needs; `tools/ci/security-gates.test.mjs` pins the `test-rider` job
- [x] Cache `~/.gradle/caches` and `~/.gradle/wrapper` (`ci-test-editors.yml`,
and the release `build-rider` job mirrors it)
- [x] The Rider plugin zip is built and attached to tag releases alongside the
diff --git a/src/sharplsp/tests/e2e_modules/configuration_live.rs b/src/sharplsp/tests/e2e_modules/configuration_live.rs
index 7dd481ab..1664c443 100644
--- a/src/sharplsp/tests/e2e_modules/configuration_live.rs
+++ b/src/sharplsp/tests/e2e_modules/configuration_live.rs
@@ -7,6 +7,10 @@ use workspace_diagnostic_support::{completed_pull, observed_request};
/// One private and one public function that nothing calls.
const DEAD_FS: &str = "module Dead\n\nlet private unusedHelper () = 1\n\nlet unusedPublic () = 2\n";
+/// One internal and one public C# type that nothing references.
+const DEAD_CS: &str =
+ "namespace Dead;\n\ninternal sealed class Hidden { }\n\npublic sealed class Orphan { }\n";
+
/// How long the server is given to notice an edited configuration file.
const NOTICED: Duration = Duration::from_secs(30);
@@ -14,7 +18,7 @@ const NOTICED: Duration = Duration::from_secs(30);
fn analyzer_settings_from_the_editor_or_the_file_apply_to_the_next_pull() {
require_dotnet();
let (workspace, source) = dead_code_workspace();
- let mut session = LiveSession::start(workspace.path(), &source);
+ let mut session = LiveSession::start(workspace.path(), &source, "SLSPF0101");
// 1. The file turns the dead-code analyzer off: nothing is reported dead.
session.assert_dead(&[]);
@@ -47,6 +51,48 @@ fn analyzer_settings_from_the_editor_or_the_file_apply_to_the_next_pull() {
session.client.shutdown_and_exit();
}
+/// [ANALYZERS-MONOREPO-GATE] through the real host and C# sidecar: an unused
+/// internal type is dead code everywhere, but an unused PUBLIC type is reported
+/// only once the workspace declares itself a monorepo — and then as an error.
+#[test]
+fn csharp_unused_public_types_are_dead_only_in_a_monorepo() {
+ require_dotnet();
+ let (workspace, source) = dead_csharp_workspace();
+ let mut session = LiveSession::start(workspace.path(), &source, "SLSPC0101");
+
+ // 1. A standard repository: the internal type is dead, a warning; the public one is API.
+ session.await_dead(&[("Hidden", 2)]);
+
+ // 2. The file declares a monorepo: the public type is dead too, and both are errors.
+ write_configuration(
+ workspace.path(),
+ "[analyzers]\ndead_code = true\nmonorepo = true\n",
+ );
+ session.await_dead(&[("Hidden", 1), ("Orphan", 1)]);
+
+ // 3. Back to a standard repository: the public type is API again.
+ write_configuration(workspace.path(), "[analyzers]\ndead_code = true\n");
+ session.await_dead(&[("Hidden", 2)]);
+ session.client.shutdown_and_exit();
+}
+
+/// A C# project with dead types, and a `sharplsp.toml` turning the dead-code analyzer on.
+fn dead_csharp_workspace() -> (tempfile::TempDir, PathBuf) {
+ let workspace = tempfile::tempdir().expect("real C# workspace");
+ let project = workspace.path().join("Dead");
+ std::fs::create_dir_all(&project).expect("project directory");
+ std::fs::write(
+ project.join("Dead.csproj"),
+ r#"
+ net10.0Library
+"#,
+ )
+ .expect("write the project");
+ std::fs::write(project.join("Dead.cs"), DEAD_CS).expect("write the source");
+ write_configuration(workspace.path(), "[analyzers]\ndead_code = true\n");
+ (workspace, project.join("Dead.cs"))
+}
+
/// An F# project with dead code, and a `sharplsp.toml` turning the dead-code analyzer off.
fn dead_code_workspace() -> (tempfile::TempDir, PathBuf) {
let workspace = tempfile::tempdir().expect("real F# workspace");
@@ -74,12 +120,14 @@ fn write_configuration(root: &Path, text: &str) {
struct LiveSession {
client: LspClient,
uri: String,
+ /// The dead-code rule of the source's language: `SLSPF0101` or `SLSPC0101`.
+ code: &'static str,
traffic: Vec,
}
impl LiveSession {
- /// Start the server with pull diagnostics and wait until the F# project loads.
- fn start(root: &Path, source: &Path) -> Self {
+ /// Start the server with pull diagnostics and wait until the project loads.
+ fn start(root: &Path, source: &Path, code: &'static str) -> Self {
let mut client = LspClient::spawn_in(Stdio::null(), Some(root));
let initialized = client.initialize_with_capabilities(
json!(path_to_file_uri(root)),
@@ -89,9 +137,10 @@ impl LiveSession {
let mut session = Self {
client,
uri: path_to_file_uri(source),
+ code,
traffic: Vec::new(),
};
- session.wait_for(NOTICED, "the F# project to load", |session| {
+ session.wait_for(NOTICED, "the project to load", |session| {
session
.received("workspace/projectInitializationComplete")
.is_some()
@@ -111,7 +160,7 @@ impl LiveSession {
.as_array()
.expect("a full report")
.iter()
- .filter(|item| item["code"] == "SLSPF0101")
+ .filter(|item| item["code"] == self.code)
.filter_map(|item| {
Some((
named(item["message"].as_str()?)?,
diff --git a/src/sidecars/SharpLsp.Sidecar.CSharp.Tests/DeadCodeAnalyzerTests.cs b/src/sidecars/SharpLsp.Sidecar.CSharp.Tests/DeadCodeAnalyzerTests.cs
index 915076a9..5fae8f06 100644
--- a/src/sidecars/SharpLsp.Sidecar.CSharp.Tests/DeadCodeAnalyzerTests.cs
+++ b/src/sidecars/SharpLsp.Sidecar.CSharp.Tests/DeadCodeAnalyzerTests.cs
@@ -137,6 +137,7 @@ public async Task NonMonorepo_reports_private_and_internal_dead_code_as_warnings
Assert.NotNull(hidden);
Assert.Equal("Warning", hidden!.Severity);
Assert.Equal("SLSPC0101", hidden.Code);
+ Assert.Equal("https://sharplsp.dev/docs/diagnostics/#dead-code", hidden.HelpLink);
Assert.Contains("Dead code", hidden.Message);
Assert.Contains("method", hidden.Message);
diff --git a/src/sidecars/SharpLsp.Sidecar.CSharp/Workspace/DeadCodeAnalyzer.cs b/src/sidecars/SharpLsp.Sidecar.CSharp/Workspace/DeadCodeAnalyzer.cs
index dddf2180..50fa8a29 100644
--- a/src/sidecars/SharpLsp.Sidecar.CSharp/Workspace/DeadCodeAnalyzer.cs
+++ b/src/sidecars/SharpLsp.Sidecar.CSharp/Workspace/DeadCodeAnalyzer.cs
@@ -1,6 +1,7 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.FindSymbols;
+using SharpLsp.Sidecar.Common;
namespace SharpLsp.Sidecar.CSharp.Workspace;
@@ -185,7 +186,7 @@ CancellationToken ct
Message: message,
Severity: severity,
Code: DiagnosticCode,
- HelpLink: "",
+ HelpLink: RuleDocumentation.DeadCode,
Tags: [DiagnosticTags.Unnecessary]
);
}
diff --git a/src/sidecars/SharpLsp.Sidecar.Common/RuleDocumentation.cs b/src/sidecars/SharpLsp.Sidecar.Common/RuleDocumentation.cs
new file mode 100644
index 00000000..28faaa12
--- /dev/null
+++ b/src/sidecars/SharpLsp.Sidecar.Common/RuleDocumentation.cs
@@ -0,0 +1,18 @@
+namespace SharpLsp.Sidecar.Common;
+
+///
+/// Where each SharpLsp-owned analyzer rule is documented: the diagnostic's
+/// codeDescription.href, so the editor links the code to its explanation.
+/// One place for both sidecars. [ANALYZERS-DIAGNOSTICS]
+///
+public static class RuleDocumentation
+{
+ /// The dead-code rules SLSPC0101 (C#) and SLSPF0101 (F#).
+ public const string DeadCode = "https://sharplsp.dev/docs/diagnostics/#dead-code";
+
+ /// The documentation of ; empty for a rule with none.
+ public static string For(string code)
+ {
+ return code is "SLSPC0101" or "SLSPF0101" ? DeadCode : "";
+ }
+}
diff --git a/src/sidecars/SharpLsp.Sidecar.FSharp.Tests/FSharpAnalyzersTests.fs b/src/sidecars/SharpLsp.Sidecar.FSharp.Tests/FSharpAnalyzersTests.fs
index adb3ab5a..4b1816a5 100644
--- a/src/sidecars/SharpLsp.Sidecar.FSharp.Tests/FSharpAnalyzersTests.fs
+++ b/src/sidecars/SharpLsp.Sidecar.FSharp.Tests/FSharpAnalyzersTests.fs
@@ -58,6 +58,10 @@ let ``buildDiagnostic maps a 1-based range to 0-based positions`` () =
Assert.Equal("SLSPF0101", d.Code)
Assert.Equal("Warning", d.Severity)
Assert.Equal("msg", d.Message)
+ // [ANALYZERS-DIAGNOSTICS]: the rule links to its documentation, as codeDescription.href.
+ Assert.Equal("https://sharplsp.dev/docs/diagnostics/#dead-code", d.HelpLink)
+ let other = FSharpAnalyzers.buildDiagnostic "SLSPF0102" "Warning" "msg" r
+ Assert.Equal("", other.HelpLink)
[]
let ``deadCodeDiagnostics returns empty when disabled`` () =
diff --git a/src/sidecars/SharpLsp.Sidecar.FSharp/FSharpAnalyzers.fs b/src/sidecars/SharpLsp.Sidecar.FSharp/FSharpAnalyzers.fs
index f83b732a..4563e2ea 100644
--- a/src/sidecars/SharpLsp.Sidecar.FSharp/FSharpAnalyzers.fs
+++ b/src/sidecars/SharpLsp.Sidecar.FSharp/FSharpAnalyzers.fs
@@ -76,7 +76,7 @@ let buildDiagnostic
Message = message
Severity = severity
Code = code
- HelpLink = ""
+ HelpLink = SharpLsp.Sidecar.Common.RuleDocumentation.For code
Tags = DiagnosticTags.ofCode code }
/// Classify a dead declaration into a diagnostic, honoring the monorepo gate.
diff --git a/src/website/src/docs/diagnostics.md b/src/website/src/docs/diagnostics.md
index 769d89b9..0a9329c2 100644
--- a/src/website/src/docs/diagnostics.md
+++ b/src/website/src/docs/diagnostics.md
@@ -68,6 +68,10 @@ monorepo = false
Project filters apply to workspace results for both languages. Direct `textDocument/diagnostic` requests remain unfiltered. Filters also accept full native project paths, using forward slashes in glob patterns.
+Dead code
+
+SharpLsp reports code that nothing references as `SLSPC0101` in C# and `SLSPF0101` in F#. The code in the Problems panel links here.
+
In normal mode, private/internal dead code is reported as a warning and public symbols are treated as possible external API. In monorepo mode, unused public symbols are also reported and use error severity.
## Severity Mapping