Skip to content

fix: handle LSP server requests and workspace initialization#1

Open
diopolgg wants to merge 1 commit into
HYMMA:masterfrom
diopolgg:fix/lsp-client-initialization
Open

fix: handle LSP server requests and workspace initialization#1
diopolgg wants to merge 1 commit into
HYMMA:masterfrom
diopolgg:fix/lsp-client-initialization

Conversation

@diopolgg

@diopolgg diopolgg commented Feb 8, 2026

Copy link
Copy Markdown

Summary

  • Fix UTF-8 BOM on stdin: Use explicit UTF8Encoding(false) for the LSP process stdin to prevent a 3-byte BOM preamble from corrupting Content-Length headers
  • Handle server-to-client requests: Respond to requests like workspace/configuration instead of silently ignoring them, which caused the server to stall
  • Wait for workspace loading: Listen for $/progress end notifications before declaring the client initialized, ensuring tools don't run against a partially loaded workspace

Test plan

  • Build the project (dotnet build)
  • Run against a C# solution and verify csharp_set_workspace completes without timeout
  • Verify diagnostics and other tools return correct results after initialization
  • Check logs for "Workspace loading completed" message on successful init
  • Verify graceful fallback when workspace loading exceeds the 2-minute timeout

🤖 Generated with Claude Code

Fix three issues in the LSP client that caused unreliable startup:

- Use explicit UTF-8 encoding without BOM on the LSP process stdin.
  StreamWriter.BaseStream was writing a 3-byte BOM preamble before
  Content-Length headers, corrupting the JSON-RPC framing.

- Handle server-to-client requests (e.g. workspace/configuration) by
  sending proper responses. Previously these were silently ignored,
  causing the server to stall waiting for a reply.

- Wait for the workspace $/progress end notification before declaring
  the client initialized, so tools don't run against a partially
  loaded workspace.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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