Cart injection: use the literal language name "Pico-8 Lua"
Zed resolves `injection.language` by matching it against the target language's `name` field ( config.toml ) via UniCase, which folds case but does NOT treat `-` as equivalent to ` `. The previous string "pico-8-lua" therefore did not resolve to any registered language and the entire __lua__ section rendered with zero highlights inside Zed. Per `LanguageRegistry::language_for_name_or_extension` in crates/language/src/language_registry.rs, only the `name` field and `path_suffixes` are consulted — the directory under languages/, the grammar `name`, the `scope`, and the tree-sitter.json `injection-regex` field are all ignored. ( `injection-regex` is a Helix/Neovim convention; Zed's production code never reads it. ) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,10 @@
|
|||||||
; Hand the body of the __lua__ section to the Pico-8 Lua grammar so the
|
; Hand the body of the __lua__ section to the Pico-8 Lua grammar so the
|
||||||
; dialect-aware parser parses it (compound-assignment statements, the `?`
|
; dialect-aware parser parses it (compound-assignment statements, the `?`
|
||||||
; print shorthand, single-line `if (cond) stmt`, peek prefixes, etc.).
|
; print shorthand, single-line `if (cond) stmt`, peek prefixes, etc.).
|
||||||
|
;
|
||||||
|
; The injection.language string must match the target language's `name`
|
||||||
|
; field in its config.toml. Zed case-folds via UniCase but does not
|
||||||
|
; treat hyphens as equivalent to spaces, so this has to be the literal
|
||||||
|
; "Pico-8 Lua" ( with a space ).
|
||||||
((lua_content) @injection.content
|
((lua_content) @injection.content
|
||||||
(#set! injection.language "pico-8-lua"))
|
(#set! injection.language "Pico-8 Lua"))
|
||||||
|
|||||||
Reference in New Issue
Block a user