Skip to content

Helix

Helix has first-class tree-sitter + LSP support, configured via TOML. httui-lang plugs in with a single languages.toml entry plus a one-time grammar fetch.

Terminal window
cargo install httui-lsp

Verify it’s on PATH:

Terminal window
httui-lsp --version

Edit ~/.config/helix/languages.toml:

[[language]]
name = "httui"
scope = "source.httui"
file-types = ["httui"]
roots = [".httui", "runbooks", "connections.toml", "envs"]
comment-token = "#"
indent = { tab-width = 2, unit = " " }
language-servers = ["httui-lsp"]
[language.auto-pairs]
'{' = '}'
'"' = '"'
"'" = "'"
'(' = ')'
[language-server.httui-lsp]
command = "httui-lsp"
[language-server.httui-lsp.config]
httui = { env = "staging" }

Append to languages.toml:

[[grammar]]
name = "httui"
source = { git = "https://github.com/httuicom/tree-sitter-httui", rev = "main" }

Then build it:

Terminal window
hx --grammar fetch
hx --grammar build

hx --health httui should now report the grammar as installed.

Helix needs the highlight queries in ~/.config/helix/runtime/queries/httui/:

Terminal window
mkdir -p ~/.config/helix/runtime/queries/httui
cd ~/.config/helix/runtime/queries/httui
curl -O https://raw.githubusercontent.com/httuicom/tree-sitter-httui/main/queries/highlights.scm
curl -O https://raw.githubusercontent.com/httuicom/tree-sitter-httui/main/queries/injections.scm
curl -O https://raw.githubusercontent.com/httuicom/tree-sitter-httui/main/queries/folds.scm

(Future: these will ship with the grammar fetch automatically when Helix’s runtime supports vendored queries.)

To get httui injection inside .md fenced blocks, Helix needs the markdown injection query updated. Add to ~/.config/helix/runtime/queries/markdown/injections.scm (extend, don’t replace):

((fenced_code_block
(info_string (language) @lang)
(code_fence_content) @injection.content)
(#match? @lang "^(http|db-)")
(#set! injection.language "httui"))

After this, fenced httui blocks inside markdown highlight correctly.

Terminal window
hx ~/runbooks/runbooks/example.httui

Inside Helix:

  • :lsp-info — should show httui-lsp running
  • Hover an {{...}} reference (default Space+k) — popup with resolved value
  • gd on a reference — jumps to alias definition
  • Space+r — rename
  • Space+a — code actions

The env setting passes through to the LSP. Edit it in languages.toml and reload (:reload).

To switch per-buffer, use the LSP workspace configuration change — Helix doesn’t have a built-in UI for this yet, but you can run:

:lsp-workspace-command httui.setEnv staging

(Custom commands exposed by httui-lsp per session.)

Helix has minimal snippet support. The httui-lsp ships completion items with snippet bodies — typing http and confirming the completion expands the scaffold. Same for db, expect, expect.status, etc.

Same pattern as Neovim — shell out to httui-tui:

~/.config/helix/config.toml
[keys.normal.space.h]
r = ":sh httui-tui run %{buffer_name} --env staging"

Space+h+r runs the current runbook in the TUI alongside Helix.

For inline run-and-show-result, the httui desktop app must be open on the same vault — then the LSP forwards to it via httui/blockRun.

Check hx --health httui:

OutputMeaning
✓ httui-lspLSP binary on PATH
✗ httui-lsp: command not foundInstall the binary
✓ grammar httuiTree-sitter parser built
✗ grammar httui: not foundRe-run hx --grammar fetch && hx --grammar build

Highlight inside markdown fences not working

Section titled “Highlight inside markdown fences not working”

The markdown injection query must explicitly mention httui (Helix doesn’t auto-inherit). See the injection snippet in Markdown integration above.

Open :log (the LSP log) and search for httui. Common: vault root not detected because the file isn’t under a folder containing .httui / runbooks / connections.toml. Workaround: create an empty connections.toml.

Helix highlight groups in your theme will pick up:

Highlight scopeRecommendation
keywordHTTP verb, language identifier
functionblock aliases in references
constantenv var keys
stringURLs, header values, literals
variable.parameterreference inner identifiers

Most themes already map these — no httui-specific work needed.