Closed
Conversation
Implement a pluggable LSP infrastructure that allows multiple language servers to be managed through a single NodeConnector. The core handles LSP protocol encoding/decoding while language-specific servers are configured by browser extensions. - Add src-node/lsp-client.js: Core LSP client with multi-server registry - Add TypeScriptSupport extension with code hints provider - Support for typescript-language-server via stdio The architecture allows future language support (Python, Rust, Go, etc.) to be added by creating browser-side extensions that configure their respective servers.
Problem: Completions popup showed global/project symbols instead of context-appropriate completions (e.g., typing `x.` on a string showed `arguments`, `config` instead of `charAt`, `toLowerCase`). Root Cause: The extension sent `textDocument/didOpen` every time `getHints()` was called, violating LSP protocol and causing the server to reset its analysis state. Changes: 1. Switch to vtsls language server (@vtsls/language-server) - Same LSP server that Zed editor uses by default - Wraps VS Code's TypeScript extension directly - Better server-side fuzzy matching and completion performance 2. Fix LSP document lifecycle (VS Code pattern) - Send `textDocument/didOpen` only once per document - Send `textDocument/didChange` for subsequent content updates - Track open documents in `openDocuments` Set - Track document versions in `documentVersions` Map 3. Add proper state cleanup - Clear tracking state on server restart (projectOpen) - Clear tracking state on shutdown - Clear tracking state on server exit - Send `textDocument/didClose` when documents are refreshed 4. Add vtsls-specific initialization options - Enable server-side fuzzy matching - Set completion entries limit to 5000 - Enable auto-use of workspace TypeScript SDK
- Add detailed architecture diagram and lifecycle documentation to lsp-client.js - Document API reference with code examples for all methods - Add step-by-step guide for adding new language support - Fix NodeConnector reuse on project switch to prevent ping timeout - Update comments to reference vtsls instead of typescript-language-server
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What kind of change does this PR introduce?
Screenshots or Gifs of the change
Does this PR introduce a breaking change?
Tests done
Checklist
Other information
pull request guidelines: