Skip to content

Test Explorer follows the chosen solution (configured, remembered, picked) + cross-language dead code is not reported (#617) - #603

Merged
MelbourneDeveloper merged 11 commits into
mainfrom
fix/remember-solution
Nov 20, 2026
Merged

MelbourneDeveloper merged 11 commits into
mainfrom
fix/remember-solution

Conversation

@MelbourneDeveloper

@MelbourneDeveloper MelbourneDeveloper commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Why

In a workspace holding many solutions (this repo has ~50 with its fixtures), the extension asked which one to load on every window reload — even when sharplsp.toml already named one in csharp.solution_path and the server had opened it. Picking a fixture solution pointed the Solution Explorer and the Test Explorer at it: Test discovery: 0 item(s) from 1 target(s).

What changes

  • Configured solution wins. The extension reads csharp.solution_path from sharplsp/configuration and loads that solution with no prompt, so the editor shows what the server opened. A stale entry (no such file) is no choice. [SHARPLSP-ARCHITECTURE-PROJECTS-SOLUTION-PATH]
  • The loaded solution is remembered per workspace, so a reload reopens it instead of asking again. Select Solution still always asks. [SE-SOLUTION]
  • Order at startup: configured → remembered → sole solution / picker.

Tests

  • solution-configured.test.ts — against a real server: unconfigured asks; a relative entry loads without asking; an absolute entry beats the remembered solution; a stale entry falls back to the remembered solution, then to the picker.
  • solution-memory.test.ts — a reload reopens the picked solution.

No new LSP infrastructure: the request is the existing sharplsp/configuration.

  • test-explorer-solution-choice.test.ts — the end-to-end proof. One user journey over a real F# xUnit solution and a real C# xUnit solution drives the live loader into the live Solution Explorer and Testing tree: a pick, a window reload, a configured solution_path, a stale one, a deliberate switch, and a dismissed pick. After each step the tree holds exactly that solution's tests (no stale ones from the other solution, one assembly root labelled for its project), the prompt count is exact, and the remembered solution is checked.

Also merged here: cross-language dead code (#617)

When a monorepo has both F# and C#, the dead-code analyzer no longer reports a public symbol that only the other language calls. Neither FCS nor Roslyn can see callers in the other language, so a project referenced from the other language reports no unused public code ([ANALYZERS-TRUTH]: say nothing rather than raise a false error). Private and internal code is still checked as before.

  • CrossLanguageReferences (Sidecar.Common) finds the projects that a project in the other language references.

  • The C# analyzer gets this through DeadCodeMode.SharedAcrossLanguages; the F# analyzer through AnalyzerConfig.SharedAcrossLanguages and ReferencedFromCSharp.

  • Two new full-stack tests, in configuration_live.rs, failed before the fix. One reported [("orphan", 1), ("used", 1)], the other [("Orphan", 1), ("Used", 1)]; both now report [].

  • Follows project edits. A compiler never reloads when a project in the other language changes. So each project's references are re-read whenever its file changes, and adding or removing a reference from the other language moves the dead-code results with no reopen. Before this, dead_code_cross_language.rs failed when the reference was removed (expected [("orphan", 1), ("used", 1)] dead; the last pull reported []); it passes now, 4/4.

Also: regex highlighting fix

[\\-[x]] is a character-class subtraction, but the highlighter checked only the single character before the -, so it treated the - as escaped. It now counts the backslashes in a row before the -, and only an odd number escapes it. A new RegexHighlightingTests row failed for exactly this reason and passes now.

#617 stays open until the released binaries are verified.

… it instead of re-prompting; Select Solution still always asks
…sion reads it from sharplsp/configuration, so the Solution Explorer and Test Explorer show the solution the server already opened; it beats a remembered pick, and a stale entry falls back to the remembered solution or the picker
…ge calls: a project an F# or C# project of the other language references reports no unused public code, since neither compiler sees the other's callers (#617)
…er a real F# and a real C# solution drives the live loader into the live Testing tree through a pick, a reload, a configured solution_path, a stale one, a deliberate switch and a dismissed pick, asserting the exact tests each time; the scratch configuration client moves into the shared kit; the cross-language dead-code test cites [ANALYZERS-TRUTH]
@MelbourneDeveloper
MelbourneDeveloper enabled auto-merge (squash) November 20, 2026 02:59
@MelbourneDeveloper MelbourneDeveloper changed the title Test Explorer no longer empties on a wrong solution pick: configured solution loads without asking, and the loaded solution is remembered Test Explorer follows the chosen solution (configured, remembered, picked) + cross-language dead code is not reported (#617) Nov 20, 2026
…btraction; only an odd run of backslashes escapes the -
…nces are re-read when its file changes, so adding or removing a reference from the other language moves public dead code without a reopen; the cross-language tests move to their own module (#617)
… c: to VS Code, C: to the OS); CrossLanguageReferences gets real-file tests in Common: solution, folder, file and missing targets, an unreadable solution, and a reference added then removed by a later edit
…their fixture: the nested Expecto case finished with its session while dotnet test was still wrapping up, the fixture vanished under it, and its terminal leaked into the Stop suite on Linux; that test now also asserts its run settled
@MelbourneDeveloper
MelbourneDeveloper merged commit 8b42f98 into main Nov 20, 2026
63 checks passed
@MelbourneDeveloper
MelbourneDeveloper deleted the fix/remember-solution branch November 20, 2026 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant