Skip to content

fix(extraction): capture Vue script call references#465

Merged
colbymchenry merged 2 commits into
colbymchenry:mainfrom
msnandhis:fix/425-vue-script-call-refs
May 27, 2026
Merged

fix(extraction): capture Vue script call references#465
colbymchenry merged 2 commits into
colbymchenry:mainfrom
msnandhis:fix/425-vue-script-call-refs

Conversation

@msnandhis
Copy link
Copy Markdown
Contributor

Summary

Fixes Vue SFC call extraction so calls inside script block initializer and method bodies are indexed correctly.

This covers two patterns reported in #425:

  • <script setup> top-level initializers, for example const token = getTokenMp()
  • Options API object methods, for example methods: { save() { getTokenMp() } }

The extractor still avoids creating noisy synthetic nodes for object-literal methods, but now walks their bodies so call references are not dropped.

Fixes #425.

Testing

  • npx -y -p node@22 -p npm@10 npm exec -- vitest run __tests__/extraction.test.ts -t "Vue Extraction"
  • npx -y -p node@22 -p npm@10 npm exec -- vitest run __tests__/extraction.test.ts __tests__/pr19-improvements.test.ts __tests__/graph.test.ts
  • npx -y -p node@22 -p npm@10 npm run build
  • npx -y -p node@22 -p npm@10 npm test

@msnandhis msnandhis force-pushed the fix/425-vue-script-call-refs branch from c9c9fd2 to d2be136 Compare May 26, 2026 18:55
The fix in src/extraction/tree-sitter.ts is not Vue-specific — the same
bug existed for any top-level `const x = foo()` in plain TS/JS. Update
the CHANGELOG to reflect the broader scope, and add a non-Vue regression
test alongside the existing "Exported Variable Extraction" suite so the
generalized fix is locked in.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CodeGraph无法识别 <script setup> 或 <script> 块中的函数调用关系

2 participants