Skip to content

feat: reusable analysis library + real semantic tokens - #3

Merged
Kinflou merged 1 commit into
masterfrom
feat/lib-and-semantic-tokens
Sep 2, 2026
Merged

feat: reusable analysis library + real semantic tokens#3
Kinflou merged 1 commit into
masterfrom
feat/lib-and-semantic-tokens

Conversation

@Kinflou

@Kinflou Kinflou commented Sep 2, 2026

Copy link
Copy Markdown
Member

PR 1 of the shared-editor-intelligence plan (playground ⇄ comline-vscode ⇄ language-server).

Library split

  • server feature (default on) gates tower-lsp / tokio / the doc store / the comline-lsp binary.
  • --no-default-features leaves parser + analysis + handlers — over lsp-types (serde-only) + comline-core — which builds for wasm32-unknown-unknown. A CI job checks it.
  • 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 consumes the lib crate.

Real semantic tokens

handlers::semantic_tokens was a stub returning []. Now a small line lexer — keywords, primitive / user types (PascalCase heuristic), strings, // comments, @annotations, numbers — emitting the delta-encoded LSP token stream. This is the single highlighter both comline-lsp (→ VS Code) and the playground editor will consume; the legend in backend.rs matches 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.

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.
@Kinflou
Kinflou merged commit b37b6f6 into master Sep 2, 2026
4 checks passed
@Kinflou
Kinflou deleted the feat/lib-and-semantic-tokens branch September 2, 2026 10:40
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