Ir al contenido

Zed

Zed bundlea tree-sitter nativamente y tiene una story limpia de extensión LSP. La extensión httui-lang para Zed wirea ambos.

  1. Abre Zed.
  2. Cmd+Shift+X → panel de Extensions.
  3. Busca “httui”.
  4. Instala httui-lang.

La extensión auto-instala el parser de tree-sitter + descarga el binario httui-lsp en el primer uso.

Zed lee .zed/settings.json por proyecto (tu vault) y ~/.config/zed/settings.json globalmente.

{
"lsp": {
"httui-lsp": {
"binary": {
"path": "httui-lsp",
"arguments": []
},
"settings": {
"httui": {
"env": "staging"
}
}
}
},
"languages": {
"httui": {
"tab_size": 2,
"format_on_save": "off",
"formatter": "language_server"
}
}
}

La extensión registra:

  • *.httui → lenguaje httui
  • *.md → markdown (httui inyecta en bloques fenced de código)

Para que la injection en markdown funcione, Zed necesita la gramática de markdown de tree-sitter (built-in) + las queries de injection de httui (shipean con la extensión). Sin config extra.

FeatureCómo usarla
Syntax highlightAutomático al abrir archivo
HoverMouse sobre {{ref}} (default K en modo vim de Zed)
Go to definitionF12 / Cmd+Click
Find referencesShift+F12
RenameF2
Code actionsCmd+.
Format documentCmd+Shift+I
Workspace symbolsCmd+T

Setea por-vault en .zed/settings.json:

{
"lsp": {
"httui-lsp": {
"settings": { "httui": { "env": "staging" } }
}
}
}

O globalmente si trabajas mayormente en un env. Para cambiar al vuelo:

Cmd+Shift+P“httui: Set active environment”.

Si la desktop app de httui está corriendo en el mismo vault, Zed muestra un lens “Run” arriba de cada bloque. Haz clic → el LSP envía httui/blockRun al desktop, que ejecuta y devuelve el resultado inline (renderizado en un panel chico debajo del bloque vía la UI inline de Zed).

Sin el desktop corriendo, el lens muestra “Run in TUI →” — hacer clic abre un split de terminal con httui-tui run <file>.

httui-lang shipea con mappings de tokens que respetan los temas de Zed:

Nodo httuiToken Zed (default)
(verb)keyword
(alias_ref ident)function
(env_ref ident)constant
(field) @assertionvariable.special
(literal) @assertionstring
(reference) (whole)embedded

Los temas custom levantan estos automáticamente. Para sobreescribir, en settings.json:

{
"experimental.theme_overrides": {
"syntax": {
"function": { "color": "#84B5FF" },
"constant": { "color": "#FFCC66" }
}
}
}

Zed lee .zed/snippets/httui.json por-proyecto:

{
"HTTP block": {
"prefix": "http",
"body": [
"http alias=$1",
"${2:GET} ${3:https://example.com/path}",
"${4:Accept: application/json}",
"$0"
]
},
"HTTP with expect": {
"prefix": "httpexpect",
"body": [
"http alias=$1",
"${2:GET} ${3:https://example.com/path}",
"",
"# expect:",
"# status == 200",
"$0"
]
},
"DB block": {
"prefix": "db",
"body": [
"db-${1:local}",
"SELECT $0"
]
}
}

La extensión no instaló el binario del LSP

Sección titulada «La extensión no instaló el binario del LSP»

La extensión descarga httui-lsp desde GitHub Releases en el primer uso. Si está offline / bloqueado:

Ventana de terminal
cargo install httui-lsp

Luego setea el path explícitamente:

{ "lsp": { "httui-lsp": { "binary": { "path": "/Users/you/.cargo/bin/httui-lsp" } } } }

Revisa el tree-sitter playground de Zed:

Cmd+Shift+P“editor: open tree-sitter playground”.

Abre un runbook .md con fences de httui. El tree debería mostrar las regiones http / db-* parseadas por httui. Si no, reinstala la extensión.

Recarga el LSP:

Cmd+Shift+P“editor: restart language server”.