From 3edfa472814817e654e5f1830cff51f51fe9bd08 Mon Sep 17 00:00:00 2001 From: Levi Neuwirth Date: Wed, 15 Jul 2026 09:41:48 +0100 Subject: [PATCH 1/7] docs(injections): framing for multi-language injections Frame the tree-sitter injection-layer engine: after the root parse, run the grammar's injections.scm, parse each embedded region with the injected language, and merge every layer's highlight spans. First consumer is markdown fenced code + inline (zero new grammars). Eleven numbered decisions (Q#IJ1-IJ11) and thirteen acceptance tests, approved over three framing rounds. Load-bearing calls: the layer set lives inside ParseTreeBundle installed atomically (Q#IJ1); a two-stage worker/settle handoff keeps parsing off the main thread and query caching in the Rc registry (Q#IJ2); recursion is depth/count/visited bounded with child-only failure (Q#IJ3); a case-folded alias map snapshotted into ParseRequest bridges Lua-set aliases to the worker (Q#IJ4); included ranges are Vec excluding children and intersected with the parent (Q#IJ5); the wire producer flattens layers into disjoint effective spans because the GPU re-sorts by start, and the GPU first-span consumer is fixed to fold (Q#IJ6). Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01YJ9FQ832QwftJXCD9LeFan --- docs/multi-language-injections-framing.md | 354 ++++++++++++++++++++++ 1 file changed, 354 insertions(+) create mode 100644 docs/multi-language-injections-framing.md diff --git a/docs/multi-language-injections-framing.md b/docs/multi-language-injections-framing.md new file mode 100644 index 0000000..bb0d353 --- /dev/null +++ b/docs/multi-language-injections-framing.md @@ -0,0 +1,354 @@ +# Multi-language injections — framing (side quest, highlight family) + +**Intent.** Teach the syntax engine that one buffer can hold more than +one language. Today pmacs parses a buffer with exactly one grammar and +runs exactly one `highlights.scm` over it ("first language wins"). This +adds tree-sitter *injection layers*: after the root parse, run the +grammar's `injections.scm` to find embedded regions (a markdown code +fence, an HTML `