Description
During a tri-comparison ledger sweep, we identified a persistent parser limitation in tree-sitter-javascript when encountering Flow type annotations (e.g. @flow pragma in react/*).
The plain JavaScript tree-sitter grammar cannot parse Flow's parenthesized type-cast syntax ((expr: Type)), producing an ERROR node that swallows large trailing regions of the file. Any real functions inside these regions (like beginWork, mountLazyComponent) are entirely missed by tree-sitter.
GitGalaxy's structural extraction regex has no dependency on the parse state and correctly finds every one of these functions.
Scope
- Affects
react/ReactFiberBeginWork.js, ReactFiberWorkLoop.js, ReactFlightServer.js, etc.
- Accounts for ~183 functions that GitGalaxy correctly captures but tree-sitter misses.
Action
This is an upstream tree-sitter limitation (or requires a dedicated Flow grammar instead of plain JS). Documented in docs/why_gitgalaxy_beats_ast_here.md. Tracking here for visibility.
Description
During a tri-comparison ledger sweep, we identified a persistent parser limitation in
tree-sitter-javascriptwhen encountering Flow type annotations (e.g.@flowpragma inreact/*).The plain JavaScript tree-sitter grammar cannot parse Flow's parenthesized type-cast syntax (
(expr: Type)), producing anERRORnode that swallows large trailing regions of the file. Any real functions inside these regions (likebeginWork,mountLazyComponent) are entirely missed by tree-sitter.GitGalaxy's structural extraction regex has no dependency on the parse state and correctly finds every one of these functions.
Scope
react/ReactFiberBeginWork.js,ReactFiberWorkLoop.js,ReactFlightServer.js, etc.Action
This is an upstream tree-sitter limitation (or requires a dedicated Flow grammar instead of plain JS). Documented in
docs/why_gitgalaxy_beats_ast_here.md. Tracking here for visibility.