Skip to content

VS Code dev host (F5) can silently run a stale published LSP server #44

Description

@clrudolphi

Problem

extension.ts's resolveServerPath resolves two different paths depending on mode:

  • Production (packaged VSIX): src/VSCode/server/<rid>/ — populated by scripts/publish-server.sh
  • Dev mode (Extension Development Host / F5): src/LSP/Reqnroll.IdeSupport.LSP.Server/bin/Release/net10.0/win-x64/publish/ — populated only by manually running dotnet publish on the server project directly

.vscode/launch.json's preLaunchTask for the "Run Extension" config is npm: compile — TypeScript compile only. Nothing rebuilds or republishes the .NET server before F5 launches the Extension Development Host. Every dev-mode run therefore reuses whatever was last manually published to that bin/Release/.../publish folder, regardless of what's changed in source since.

How this bit us

While verifying #39 (ambiguous-step hover message) in VS Code, the hover still showed the old generic "Ambiguous step definition." message even though the fix was merged into the branch under test. Comparing the wire-level textDocument/publishDiagnostics payload in the LSP inspector log against the fix commit timestamp confirmed the server binary predated the fix by ~2.5 hours — a stale publish, not a code bug. Easy to lose time chasing a phantom regression this way.

Proposed fix

Add a preLaunchTask (or a chained npm script run before compile) to .vscode/launch.json that republishes the LSP server for the current platform before every F5 launch, so the Extension Development Host always reflects current source. Likely reuses (or is closely modeled on) scripts/publish-server.sh, but should be fast enough not to meaningfully slow down the F5 inner loop (e.g. skip if source is unchanged since the last publish, if that's easy to detect cheaply).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttech-debtTechnical debt / cleanupvscodeVS Code extension

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions