Repository navigation
Description
During a tri-comparison ledger sweep (typescript backlog, docs/self_scan/tri_comparison_ledger.json), a full-corpus func_start diff against tree-sitter found that GitGalaxy's TypeScript func_start regex never matches a real method/function named catch.
Real example, vscode/async.ts:74 (a Promise-like thenable class):
then<TResult1 = T, TResult2 = never>(resolve?: ..., reject?: ...): Promise<TResult1 | TResult2> {
return promise.then(resolve, reject);
}
catch<TResult = never>(reject?: ((reason: unknown) => TResult | Promise<TResult>) | undefined | null): Promise<T | TResult> {
return this.then(undefined, reject);
}
finally(onfinally?: (() => void) | undefined | null): Promise<T> {
return promise.finally(onfinally);
}then and finally are both correctly extracted (confirmed via function_data); catch — structurally identical, including the same generic-type-parameter shape then already handles fine post-#2219 — is silently dropped.
Root cause: LANGUAGE_DEFINITIONS["typescript"]["rules"]["func_start"] in gitgalaxy/standards/language_standards.py has a reserved-keyword negative lookahead (appearing at two points in the pattern) that excludes catch along with class|interface|enum|if|for|while|switch|return|throw|new|typeof|jQuery|function|yield|await|void:
(?!(?:class|interface|enum|if|for|while|switch|catch|return|throw|new|typeof|jQuery|function|yield|await|void)\b|type\b(?![ \t\n]*\()|\$)
This shield exists for a real reason — confirmed via direct regex testing that } catch (e) { (a genuine control-flow block) does NOT false-positive as a method definition, and removing catch from the exclusion list naively would very likely reopen that false-positive. But it also means catch used as a legitimate method name (any Promise/Thenable-shaped class, .catch()-alike APIs) can never be extracted, ever, regardless of generics/modifiers/context.
Confirmed scope: exactly 1 occurrence in the 23-file typescript corpus (language-crucible/data/typescript), via tri_comparison_gatherer.gather_language("typescript") name-diffed against tree-sitter across every file. ctags also misses it (confirmed via a direct ctags -x --languages=TypeScript --kinds-TypeScript=* vscode/async.ts run — no tag anywhere near line 74), so GitGalaxy is not uniquely at fault here, but it is still a real, verified false negative.
Why not fixed inline: distinguishing "method named catch" from "control-flow catch (e) {" from text shape alone needs real design work (e.g. requiring the preceding non-whitespace token be }+newline+no-modifier for the control-flow case vs. a class-body context for the method case) — not a safe one-line regex tweak, so filing rather than shipping a fix in the same pass, per this repo's tri-comparison-ledger-sweep skill's own scope discipline.
Activity
squid-protocol commentedon Aug 26, 2026
Second confirmed instance in the same sweep:
vscode/async.ts:2511-2513, another reserved word in the samefunc_startexclusion list —returnis a real, legitimate property name here (implementing theAsyncIteratorprotocol'sreturn()method) — sitting on its own line, not comma-preceded, so this isn't the line-start issue (#2277); it's excluded purely becausereturnis in the same negative-lookahead list ascatch.next(not excluded) is found fine;throwis also in the exclusion list and worth checking too, though not separately confirmed here. Same fix-direction caveat applies: distinguishingreturn: () => {}(property) from a realreturnstatement from text shape alone needs the same kind of design work ascatch, not a blind removal from the exclusion list.Root-cause and file GitHub issues for TypeScript's real func_start re…
chore: bless golden masters + tree-sitter baseline for #2276's fix
Merge origin/main into fix/typescript-2277-line-start-anchor
chore: re-bless golden masters against merged main (#2276 + #2277)
fix(typescript): recognize arrow/method-shorthand defs not at line st…
Merge origin/main into fix/typescript-2279-bodyless-notype
chore: re-bless golden masters + baseline against merged main (#2276+#…
Merge origin/main into fix/typescript-2278-overload-collapse
chore: re-bless golden masters against merged main (#2276+#2277+#2278)
fix(typescript/javascript): stop dropping bodyless overload signatures (
fix(typescript): recognize bodyless constructor declarations (#2283)
fix(core-engine): Rosetta corpus sweep — six extraction/DAG/recorder …