Skip to content

feat(desktop): lsp diagnostics, hover and completion in editor#76

Merged
gandarfh merged 2 commits into
mainfrom
feat/lsp-desktop-integration
Jun 10, 2026
Merged

feat(desktop): lsp diagnostics, hover and completion in editor#76
gandarfh merged 2 commits into
mainfrom
feat/lsp-desktop-integration

Conversation

@gandarfh

Copy link
Copy Markdown
Member

What

The desktop editor now talks to the httui language server: unknown block aliases get a red squiggle with a message, hovering a {{ref}} shows alias info from the server, and {{ completion offers in-scope aliases plus environment variable names (secrets labeled). Manually validated in a real vault.

How

  • src-tauri/src/lsp_sidecar.rs — lazy spawn of httui-lsp (PATH or HTTUI_LSP_BIN) with --db pointing at the app database; the webview cannot speak stdio, so the Rust side owns Content-Length framing and bridges messages as lsp_send invokes one way and lsp:message/lsp:exit events the other.
  • src/lib/lsp/transport.ts@codemirror/lsp-client transport over that bridge, queueing messages until the sidecar is up and re-starting it after exit.
  • src/lib/lsp/client.ts — one shared client per app process, with server-pushed diagnostics enabled.
  • src/lib/codemirror/cm-lsp.ts — per-file extension (LSP plugin with the vault file URI, server completion, hover tooltips), wired in MarkdownEditor.

The local {{ autocomplete and ref hover stay active alongside the server path on purpose: the local hover is still the only source of run-time values, and the server grammar does not parse $prev yet. The local path is removed once the server reaches feature parity.

Tests

  • Rust: framing round-trip through a fake server binary under a mock app (spawn, idempotent start, send, event emission), plus pure framing/parsing cases.
  • Frontend: transport queueing/flush ordering, single start, event dispatch, restart after exit, URI building, and extension construction. Full suite: 3170 tests green.

New dependency: @codemirror/lsp-client (approved).

@gandarfh gandarfh changed the title Language-server diagnostics, hover and completion in the editor feat(desktop): lsp diagnostics, hover and completion in editor Jun 10, 2026
@gandarfh
gandarfh force-pushed the feat/lsp-desktop-integration branch 2 times, most recently from 2fdce05 to 0a893be Compare June 10, 2026 13:45
@gandarfh
gandarfh force-pushed the feat/lsp-desktop-integration branch from 0a893be to 5b6731d Compare June 10, 2026 13:50
@gandarfh
gandarfh merged commit dad2a10 into main Jun 10, 2026
8 of 9 checks passed
@gandarfh
gandarfh deleted the feat/lsp-desktop-integration branch June 10, 2026 14:15
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