feat: reusable analysis library + real semantic tokens - #3
Merged
Conversation
Makes the crate a library the playground can link, so the browser editor
runs the LSP's own code instead of a re-implementation.
- `server` feature (default) gates `tower-lsp` / `tokio` / the doc store /
the `comline-lsp` bin. `--no-default-features` leaves `parser` +
`analysis` + `handlers` over `lsp-types` + `comline-core`, which builds
for `wasm32-unknown-unknown` (a CI job checks it).
- the handlers already take `&str` + `lsp-types` values — swapped the
`tower_lsp::lsp_types` re-export for a direct `lsp-types` dep; dropped
unused deps (`serde`, `serde_json`, `ariadne`, `codespan-reporting`);
`main.rs` now uses the lib crate instead of re-declaring modules.
- `semantic_tokens`: was a stub returning `[]`. Now a small line lexer —
keywords, primitive / user types, strings, `//` comments, `@annotations`,
numbers — emitting the delta-encoded LSP token stream. This is the single
highlighter both `comline-lsp` and the playground consume; the legend in
`backend.rs` matches its indices.
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.
PR 1 of the shared-editor-intelligence plan (playground ⇄ comline-vscode ⇄ language-server).
Library split
serverfeature (default on) gatestower-lsp/tokio/ the doc store / thecomline-lspbinary.--no-default-featuresleavesparser+analysis+handlers— overlsp-types(serde-only) +comline-core— which builds forwasm32-unknown-unknown. A CI job checks it.&str+lsp-typesvalues; swapped thetower_lsp::lsp_typesre-export for a directlsp-typesdep. Dropped unused deps (serde,serde_json,ariadne,codespan-reporting).main.rsnow consumes the lib crate.Real semantic tokens
handlers::semantic_tokenswas a stub returning[]. Now a small line lexer — keywords, primitive / user types (PascalCaseheuristic), strings,//comments,@annotations, numbers — emitting the delta-encoded LSP token stream. This is the single highlighter bothcomline-lsp(→ VS Code) and the playground editor will consume; the legend inbackend.rsmatches its indices.45 unit + 2 e2e + 4 integration tests green; server and wasm both build.
Next: the playground's WASM crate links this and re-exposes
semantic_tokens/hover/completions; the app swaps its<textarea>for CodeMirror 6 fed by them.