Repository navigation
fix(ts-lsp): resolve JSX calls from top-level arrow components - #2579
Conversation
Signed-off-by: lorenzozanee <wyz0707@proton.me>
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
|
Thanks for addressing JSX calls from top-level arrow components and including both direct and exported forms. I have read the focused results and lint limitation; this remains pending maintainer review. |
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Walking top-level arrow components also bound every exported `const` declaration into the module root scope in pass 1. A root-scope binding makes the JSX resolver fail closed and the exact same-module call path skip the name, so a same-file `<Badge />` rendered from a function component lost its CALLS edge (JSX carriers have no other resolver), and calls such as `formatLabel()` fell back from lsp_ts_local to same_module. Walking the arrow bodies does not need that binding, so drop it, and pin both forms with a test that renders and calls an exported arrow const from a function component and from an arrow component. On excalidraw/excalidraw @ e1b7aacb the change keeps every edge it adds over main (+270 CALLS, 0 removed; 6 more same-file JSX edges than with the binding) and the 17 lsp_ts_local -> same_module downgrades are gone. Also joins one declaration line that clang-format reflows. Refs DeusData#2559 Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
|
Thank you very much for this, @lorenzozanee. Routing the top-level arrow initializers through the existing body processor is exactly the right layer: the calls keep their exact source sites, and your test pins the caller identity, the span and the strategy for direct, exported and declared components alike. We measured it on a real React code base (excalidraw) against current main: 160 new JSX render edges from arrow components, 104 new method calls resolved inside arrow functions, about 1,200 existing calls now confirmed by the TypeScript resolver, and nothing lost. To get it merged without another round trip, we pushed a few small commits on top of your branch:
Other component shapes ( |
What does this PR do?
Top-level const arrow components currently lose semantic
CALLSedges to components rendered in JSX. This routes direct and export-wrapped arrow initializers through the existing TypeScript LSP body processor, preserving exact source-site resolution.Validation:
TMPDIR=/tmp scripts/test.sh --suites ts_lsp(311 passed) andTMPDIR=/tmp scripts/test.sh --suites extraction(434 passed).scripts/lint.shdid not complete because clang-tidy, cppcheck, and clang-format are unavailable.AI disclosure: Prepared with OpenAI Codex on behalf of @lorenzozanee.
Fixes #2559
Checklist
git commit -s) — required, CI rejectsunsigned commits (DCO, see CONTRIBUTING.md)
make -f Makefile.cbm test)make -f Makefile.cbm lint-ci)