fix(lsp): gate rust-analyzer/reloadWorkspace behind rust-analyzer check
reloadServer() sent the rust-analyzer-specific rust-analyzer/reloadWorkspace request to every server before falling back to workspace/didChangeConfiguration. Servers that crash on an unknown method instead of replying -32601 (Roslyn, dotnet/roslyn#84890) were killed by `lsp reload` rather than reloaded. Gate the request on isRustAnalyzerClient (exported from client.ts) or a "rust-analyzer" server name; every other server reloads via workspace/didChangeConfiguration directly. Consolidate tool.ts's inline rust-analyzer detection onto the same helper. Fixes #8571
This commit is contained in:
+1
-1
@@ -211,7 +211,7 @@ Uses the same location normalization and output shape as `definition`, but sends
|
||||
**Execution**
|
||||
- Workspace mode first invalidates the per-cwd configuration cache, reloads configuration from disk, and then reloads every newly configured non-custom LSP server.
|
||||
- Single-file mode keeps the cached configuration and reloads the primary server for that file.
|
||||
- Both modes clear matching recent initialization failures before starting a server. `reloadServer()` then tries the `rust-analyzer/reloadWorkspace` request, falls back to a `workspace/didChangeConfiguration` notification with `{ settings: {} }`, and finally tears down the client so the next request cold-starts it. For a shared-mux client, teardown first sends the mux restart notification so the shared server—not only this session's link—is replaced.
|
||||
- Both modes clear matching recent initialization failures before starting a server. For rust-analyzer servers, `reloadServer()` first tries the `rust-analyzer/reloadWorkspace` request (only rust-analyzer implements it; sending it to other servers such as Roslyn can crash them, so it is gated on the server binary/name). Every server then falls back to a `workspace/didChangeConfiguration` notification with `{ settings: {} }`, and finally tears down the client so the next request cold-starts it. For a shared-mux client, teardown first sends the mux restart notification so the shared server—not only this session's link—is replaced.
|
||||
|
||||
**Output text**
|
||||
- One line per server: `Reloaded <server>`, `Restarted <server>`, or `Failed to reload <server>: ...`.
|
||||
|
||||
Reference in New Issue
Block a user