From ba2dd6a9a28806073271aa06198948ec96de7966 Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Fri, 1 May 2026 13:20:57 -0700 Subject: [PATCH] Cart injection: use the literal language name "Pico-8 Lua" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- languages/pico-8-cart/injections.scm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/languages/pico-8-cart/injections.scm b/languages/pico-8-cart/injections.scm index ad5251d..4d5d212 100644 --- a/languages/pico-8-cart/injections.scm +++ b/languages/pico-8-cart/injections.scm @@ -1,5 +1,10 @@ ; Hand the body of the __lua__ section to the Pico-8 Lua grammar so the ; dialect-aware parser parses it (compound-assignment statements, the `?` ; 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 - (#set! injection.language "pico-8-lua")) + (#set! injection.language "Pico-8 Lua"))