Repository navigation
Conversation
maxmilian
marked this pull request as ready for review
October 16, 2026 01:06
…olbymchenry#2570) The Vue extractor only recognised lang="ts" / "typescript", so a lang="tsx" script fell through to the JavaScript grammar. A macro-only script like withDefaults(defineProps<T>(), ...) produced no symbols and a parse_error warning; a script with other declarations hid the same erroneous parse (the warning only fires when nothing survives) and lost its interfaces. Carry the script's language on the block instead of an isTypeScript flag: tsx -> tsx, ts/typescript -> typescript, otherwise javascript. The viewer's script-region detection follows for Vue, so highlighting uses the grammar the graph was built from. Svelte is unchanged: it has no TSX script language. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AYgh5cxt3ru1kLDYSJ3gta
…chenry#2570) The viewer's script regions matched lang="TSX" / "TS" case-insensitively while the extractor did not, so an uppercase lang was highlighted as TSX but indexed as JavaScript. Match it case-insensitively in the extractor too and normalise it, so both read the same grammar. Also mention TSX in the highlight languages comment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AYgh5cxt3ru1kLDYSJ3gta
maxmilian
force-pushed
the
fix/2570-vue-tsx-script
branch
from
October 23, 2026 01:57
eb39145 to
7eb7598
Compare
Owner
|
Thanks for this fix, @maxmilian! #2570 was fixed on main by #2824, which your PR guided and which credits you; it also makes Vue-only projects load the TSX grammar. Your tests pass on current main except the uppercase |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2570
Problem
src/extraction/vue-extractor.tspicked a script block's grammar fromlang="ts"/lang="typescript"only, so<script lang="tsx">was parsed as JavaScript. The JavaScript grammar cannot read TypeScript, so:withDefaults(defineProps<{ title?: string }>(), …)produced no symbols and aparse_errorwarning;interfacedeclared in the script never reached the graph.Fix
src/extraction/vue-extractor.ts: each script block now carries its language instead of anisTypeScriptflag:tsx→tsx,ts/typescript→typescript, otherwisejavascript. The attribute is matched case-insensitively (lang="TSX",lang="TS"), as the viewer already did.tsxis an existing language, and the block still goes through the sameTreeSitterExtractorpath as before.src/extraction/syntax-tokens.ts: the viewer's script-region detection reads a Vuelang="tsx"block astsxtoo. Its comment says the viewer reads a component with the same grammar the graph was built from, so it has to change with the extractor.Svelte is unchanged.
svelte-extractor.tshas the samets|typescriptcheck, but Svelte has no TSX script language, so the viewer mapstsxonly for Vue and stays in step with each extractor.Tests
New
__tests__/vue-tsx-script.test.ts:parse_errortsxand the TSX parse of it has no error. As the issue says, a missing warning alone does not show which grammar ran.interface, both functions, and the call made inside JSX (Row→shout)lang="TSX"andlang='tsx'givetsxin both the extractor and the viewer, andlang="TS"givestypescriptlang="ts"is still TypeScript and a script withoutlangis still JavaScriptRed first: with the
src/change stashed, the first three fail (parse_errorpresent, regionjavascript,interfacemissing), and the control passes. The case test failed before the extractor matchedlangcase-insensitively (the viewer saidtsx, the extractor lost theinterface).npm run buildandnpm teston Node 22: 570 files passed, 16 skipped; 6821 tests passed, 353 skipped.Notes
[Unreleased]→### Fixes.🤖 Generated with Claude Code