You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TSX: bare & in JSX text node triggers partial extraction (tree-sitter-javascript rejects valid JSX) #2922
A bare & character in a JSX text node (e.g. <div>VoIP & Chamadas</div>) is rejected by the bundled tree-sitter-javascript grammar, causing the file to be partially extracted with a "syntax errors" warning. The file is valid TSX — esbuild, tsc, and React all accept it without complaint.
On our 3 000-file TSX codebase, 31 files (1 %) are affected, all because UI labels use & as a natural-language connector (e.g. Conexões & Integrações, Configurações & Perfil, Privacidade & LGPD).
Reproduction — minimal
// with_amp.tsx — triggers "syntax errors" warning, first error at line 2exportfunctionA(){return<div>VoIP &Chamadas</div>;}
// no_amp.tsx — parses cleanlyexportfunctionB(){return<div>VoIP e Chamadas</div>;}
Place both files in an empty directory and run:
graphify update . --force
Result:
warning: 1 file(s) had syntax errors and may be partially extracted: with_amp.tsx (first error at line 2) (#2551)
no_amp.tsx extracts cleanly, confirming the trigger is the bare &.
Why a workaround is impractical
The obvious fix (& → & in a copy of the source before extraction) breaks TypeScript intersection types (type X = A & B → A & B is a TS parse error). Distinguishing JSX text & from intersection-type & requires exactly the parser that is failing. On our repo a blind replacement increased the warning count from 31 to 55.
Same shape as #2551 (grammar-level, valid source, exit 0, silent partial extraction), different language/construct. Tree-sitter-javascript appears to expect & in JSX text nodes despite JSX/React explicitly allowing bare &.
Environment
graphify 0.9.37
Language: TSX (React + TypeScript)
Trigger construct: bare & in JSX text node
esbuild / tsc / React: all accept the file cleanly
Expected behaviour
Bare & in a JSX text node should parse without a syntax error, matching the behaviour of every other JSX toolchain.
Still present in 0.9.56, and on our codebase it is not always partial — sometimes the whole file is lost.
Three pages of a Next.js 14 app trip it; a fourth with the same layout and imports but no & parses cleanly:
warning: 3 file(s) had syntax errors and may be partially extracted:
datenschutz.tsx (first error at line 1, no symbols extracted),
methoden.tsx (first error at line 57, 3 symbol(s) extracted),
nutzungsbedingungen.tsx (first error at line 17, 2 symbol(s) extracted)
The 686-line privacy page yields zero symbols — only the file node reaches the graph. Locating the ERROR nodes explains both that and the misleading line number:
importtree_sitter_typescriptaststfromtree_sitterimportLanguage, Parserp=Parser(Language(tst.language_tsx()))
tree=p.parse(open('datenschutz.tsx','rb').read())
# walk for ERROR nodes:# methoden.tsx line 57 ERROR '& Techniken'# methoden.tsx line 63 ERROR '& Slow Smoken oder die perfekte ...'# datenschutz.tsx line 1-687 ERROR <entire file>
So depending on where the ampersand sits, the ERROR node swallows the whole translation unit, the reported position collapses to line 1, and every symbol in the file is gone. From the outside this looks like a different bug than the one reported here, which cost us a while — worth mentioning in the title or body.
The trigger is identical to yours; ours are German headings (CDN & DNS, Cookies & lokale Speicherung, Melde- & Abhilfeverfahren). Same result on Windows 11 (uv tool install) and in a clean Linux container.
Versions: graphifyy 0.9.56 · tree-sitter 0.25.2 · tree-sitter-typescript 0.23.2 (newest published, while tree-sitter-javascript and tree-sitter-python are already at 0.25.x) · Python 3.11.
If the grammar fix has to wait on upstream, error recovery on the graphify side would already help: one ERROR node should not discard the declarations the parser found elsewhere in the file. "One section missing" beats "no symbols extracted".
Activity
Steakakademie commentedon Sep 7, 2026
Still present in 0.9.56, and on our codebase it is not always partial — sometimes the whole file is lost.
Three pages of a Next.js 14 app trip it; a fourth with the same layout and imports but no
&parses cleanly:The 686-line privacy page yields zero symbols — only the file node reaches the graph. Locating the ERROR nodes explains both that and the misleading line number:
So depending on where the ampersand sits, the ERROR node swallows the whole translation unit, the reported position collapses to line 1, and every symbol in the file is gone. From the outside this looks like a different bug than the one reported here, which cost us a while — worth mentioning in the title or body.
The trigger is identical to yours; ours are German headings (
CDN & DNS,Cookies & lokale Speicherung,Melde- & Abhilfeverfahren). Same result on Windows 11 (uv tool install) and in a clean Linux container.Versions: graphifyy 0.9.56 · tree-sitter 0.25.2 · tree-sitter-typescript 0.23.2 (newest published, while
tree-sitter-javascriptandtree-sitter-pythonare already at 0.25.x) · Python 3.11.If the grammar fix has to wait on upstream, error recovery on the graphify side would already help: one ERROR node should not discard the declarations the parser found elsewhere in the file. "One section missing" beats "no symbols extracted".
fix(extract): mask bare & in TSX JSX text so partial extraction stops (…