feat(language-server): @use document links, @use export completion and document highlights #264

Merged
abiwab merged 2 commits from feat/lsp-links-highlights into dev/1.6 2026-11-26 09:36:56 +01:00
Owner

PR 1 of the DX plan (phase 1A), in packages/language-server, for every LSP client:

  • Document links (textDocument/documentLink): the path of every @use "…" links to the module the graph resolved it to (aliases included). No link for MODULE_NOT_FOUND; a module that does not parse keeps its link.
  • @use export completion: after as & the default export's name, inside as { … } the exported sections not bound yet (multi-word names inserted as name{}), nothing on a local name. Read from the live line prefix and from the module through the LSP module host (computeExports), so it works while the line does not parse yet; @use path completion now also works in a document that does not parse.
  • Document highlight (textDocument/documentHighlight): ingredients grouped by slugify id (alternatives, composite parent, @& targets), intermediates (->& and @use bindings as Write, &ref and & targets as Read). Names only, never the whole mention.
  • Both capabilities announced to every client profile.

Tests: new document-links.test.ts and document-highlight.test.ts; completions-imports.test.ts, capabilities.test.ts and generic-client.test.ts (views: false, end to end on a two-file project) extended. Language server: 314 pass, typecheck and biome clean, docs build OK.

Docs (en + fr): language-server.mdx (Document Highlight, Document Link, Completion), a Navigation column in the editors.mdx matrix, language server README. Changeset minor on @gram-lang/language-server.

PR 1 of the DX plan (phase 1A), in `packages/language-server`, for every LSP client: - **Document links** (`textDocument/documentLink`): the path of every `@use "…"` links to the module the graph resolved it to (aliases included). No link for `MODULE_NOT_FOUND`; a module that does not parse keeps its link. - **`@use` export completion**: after `as &` the default export's name, inside `as { … }` the exported sections not bound yet (multi-word names inserted as `name{}`), nothing on a local name. Read from the live line prefix and from the module through the LSP module host (`computeExports`), so it works while the line does not parse yet; `@use` path completion now also works in a document that does not parse. - **Document highlight** (`textDocument/documentHighlight`): ingredients grouped by `slugify` id (alternatives, composite parent, `@&` targets), intermediates (`->&` and `@use` bindings as Write, `&ref` and `&` targets as Read). Names only, never the whole mention. - Both capabilities announced to every client profile. Tests: new `document-links.test.ts` and `document-highlight.test.ts`; `completions-imports.test.ts`, `capabilities.test.ts` and `generic-client.test.ts` (`views: false`, end to end on a two-file project) extended. Language server: 314 pass, typecheck and biome clean, docs build OK. Docs (en + fr): `language-server.mdx` (Document Highlight, Document Link, Completion), a Navigation column in the `editors.mdx` matrix, language server README. Changeset `minor` on `@gram-lang/language-server`.
abiwab merged commit c8b2930bdc into dev/1.6 2026-11-26 09:36:56 +01:00
abiwab deleted branch feat/lsp-links-highlights 2026-11-26 09:36:56 +01:00
Sign in to join this conversation.
No description provided.