Fix highlighting lag and helm-ls settings on real charts - #32
Merged
Merged
Conversation
Empty YAML mappings like emptyDir: {} split the go-template lexer into
separate { and } text nodes, which Zed's combined YAML injection drops
during incremental edits. Pin the grammar to the lexer fix that keeps
{} as one text node.
Highlight queries now match builtins with #any-of? on function names
only, and cover include, tpl, sha512sum, plus .Values/.Release. File
detection covers helmfile and .tpl without stealing every YAML file.
helm-ls workspace config is wrapped under helm-ls so yamlls.enabled
actually applies, languageId is helm, and yaml-language-server is
passed through when it is on PATH.
cabrinha
marked this pull request as ready for review
August 26, 2026 23:29
cursor
Bot
force-pushed
the
cursor/helm-speed-accuracy-ef72
branch
from
August 26, 2026 23:34
15da7e7 to
42f4fe9
Compare
Zed refuses to register the Helm language when brackets.scm names a
node type the helm dialect grammar does not emit. The backtick rule
was that: .tpl files showed as Unknown and highlighting never ran.
Keep {{ }}, {{- -}}, (), and " pairs. Compile every .scm query against
the pinned grammar in check-grammar.sh so a bad node type fails CI
instead of Zed language load.
Zed fails language load when injections.scm sets both @content and @injection.content on the same pattern. Helm never registered: .tpl stayed Unknown and the language picker had no Helm entry. Keep the published @content + language/combined form. Zed accepts either capture style, not both. check-grammar.sh now rejects a dual-capture injections.scm because tree-sitter query does not.
tree-sitter query still compiles @content and @injection.content on the same pattern. Zed's language_registry does not, and Helm never registers. Keep the published @content + language/combined query so combined YAML injection still covers emptyDir: {}. check-grammar.sh now mirrors the Zed capture-name check and asserts the exact dual-capture query from Zed.log is rejected.
The #53 grammar pin is in the wasm Zed compiles: dialects/helm/src
keeps `{}` as one text node on full parse and after an incremental
edit next to the mapping. Combined YAML injection is still set.
Smoke testing PR #32 in Zed still drops YAML keys when typing next
to emptyDir: {}. That matches zed-industries/zed#57341. tree-sitter
and Neovim restitch the fragments; Zed's combined layer does not
on buffer updates. Removing combined would only hide the core bug
and would stop YAML from stitching across {{ }} on load.
check-grammar.sh now asserts the empty-brace tokens are in the
pinned grammar.json and that an incremental edit after {} does not
split a lone `{` node.
Zed screenshots of empty-mapping.tpl on this PR: YAML keys and {{ }}
highlighted on open; after typing space then x at the end of
emptyDir: {}, every YAML key went plain while {{ }} stayed colored;
undo did not restore. That is zed-industries/zed#57341. Combined
injection is one YAML layer; an incremental splice drops it.
Keep the #53 grammar pin so {} is one text node. Inject each (text)
node as its own YAML layer so an edit next to emptyDir: {} cannot
wipe keys in other fragments. Do not set combined. Dual-capture
query-load fixes are unchanged.
#53 stopped the text token at `}`. Typing at EOL after emptyDir: {}
inserted into the next (text) node, so YAML for keys below started
with those characters and went plain (configMap, name).
Keep `{}` plus [^\n{]* in one token. Keys on later lines stay a
clean YAML fragment. Still no combined injection (zed#57341).
Query-load fixes are unchanged.
Zed compiles parser.c from this pin, not the working tree. Point grammars.helm at vendor/tree-sitter-helm @ 22fd4dc so the emptyDir EOL fix is what the extension actually loads.
5095657 and the rest-of-line token still ended at `}`. Typing at EOL after emptyDir: {} sat on the next (text) node's start. Zed dropped that node's YAML layer: keys below went plain, {{ }} stayed colored. Eat the trailing newline in the {} token. The following keys start on the next line, outside the edit range, and stay a valid YAML fragment. Still no combined injection (zed#57341).
Zed compiles parser.c from this pin. Point grammars.helm at vendor/tree-sitter-helm @ d4a62d1 so an EOL edit after emptyDir: {} is inside that text node, not on the following keys' YAML layer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes empty YAML mappings breaking highlight after edit (#22) as far as the grammar and injection model allow, incomplete file detection (#9), and helm-ls / yamlls settings that never reached the server (#17).
Query-load bugs (invalid backtick in
brackets.scm, dual@content/@injection.content) are unchanged and still fixed. Helm loads..tplis Helm.Issue #22
Zed retest of 5095657 (per-node YAML, no
combined) ontests/fixtures/empty-mapping.tpl: keys above and onemptyDir: {} xstayed colored; keys below (- name: config,configMap:,name:) went plain;{{ }}on line 18 stayed colored; undo restored. That is not the full-file combined wipe (zed#57341).Cause: the
#53/ rest-of-line token still ended at}. EOL is the next(text)node's start (the newline + keys below). Zed's incremental injection only re-queries the changed byte range and prunes layers that touch it, so the keys-below YAML layer is dropped (or re-parsed as a fragment that starts withx, which tree-sitter-yaml cannot highlight).This tip's lexer is
/[^{]+\{\}[^\n{]*\n?/:{}, rest of line, and the trailing newline are one token. The following keys start on the next line, outside the EOL insert. AfteremptyDir: {} xthey remain a clean YAML fragment. YAML is still injected per(text)node, not combined.extension.tomlpinsvendor/tree-sitter-helm@d4a62d1. Rebuild the dev extension so Zed compiles thatparser.c(it does not use the working tree grammar otherwise).What changed
Grammar. Vendored helm dialect: empty-brace token includes rest of line and newline.
YAML injection.
@content+#set! language yamlonly. Nocombined.Highlight / brackets / file detection / helm-ls. Same as earlier revisions of this PR.
How I tested
tree-sitter 0.25.10 on
empty-mapping.yaml/.tpl:emptyDir: {}text node ends at the start of the next line (erow=15 ecol=0), not at}xafter}:emptyDir: {} xstays in that node; the next node is still- name: config/configMapand does not start withxcheck-grammar.shfails if the{}node stops at}or ifcombined/ dual captures come backPlease rebuild Helm from this tip, open
tests/fixtures/empty-mapping.tpl, type space thenxat the end ofemptyDir: {}. Keys above and below should stay colored.