feat: add Phase 1 Language Host with tree-sitter features - #240
Merged
Conversation
Unify the wire frame to 8 bytes [reqId(4)][len(4)][payload] across the renderer, the electron-main relay, and the Rust host. The Phase 0 relay's 4-byte length header misread the renderer's reqId as the payload length, breaking the path. Add a request-id multiplexer: notifications (reqId=0, no response) for document sync (didOpen/didChange/didClose with full-text replace), and requests (reqId>0, response awaited) for language features. The electron-main relay becomes a transparent 8-byte-frame pass-through. Register tree-sitter-typescript backed documentSymbol and foldingRange providers for the configured languages. The documentSymbol/foldingRange path now carries the wire validation that the Phase 0 echo probe provided; echo is removed. Co-Authored-By: Claude <noreply@anthropic.com>
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.
Summary
Phase 1 of the native (Rust) Language Host: tree-sitter-backed
documentSymbolandfoldingRangefor the configured languages, replacing the Phase 0 echo probe.Changes
languageHostProtocol.ts): unified the frame to 8 bytes[reqId(4)][len(4)][payload]across renderer, electron-main relay, and Rust. Added a request-id multiplexer — notifications (reqId=0, no response) for document sync, requests (reqId>0, response awaited) for language features.documentSync.ts):didOpen/didChange/didCloseover notifications. Phase 1 sends the full text on every change (full-text replace) to avoid an incremental range-merge engine.languageFeatures.ts):documentSymbolandfoldingRangeproviders registered withILanguageFeaturesServicefor the configured languages.languageHostServerService.ts): simplified to a transparent 8-byte-frame pass-through. The Phase 0 relay's 4-byte length header misread the renderer'sreqIdas the payload length, which broke the path.main.rs):tree-sitter+tree-sitter-typescriptparse the document and emit symbols (function / class / method / interface / enum / type) and foldable block ranges.echoprobe; thedocumentSymbol/foldingRangepath now carries the wire validation.How to verify
Default remains off; with an empty `languages` array the feature is inert.
Notes