mirror of
https://github.com/colbymchenry/codegraph.git
synced 2026-10-29 06:46:49 +08:00
fix(vue): the Vue resolver only resolves a Vue app's scripts (#2210)
Framework resolvers see every reference of every language, and the Vue resolver had no language guard: its PascalCase-component rule took mealie's Python `QueryFilterBuilder(...)` (an unresolved import) to the `QueryFilterBuilder.vue` component at 0.8, and its macro / auto-import rules matched any language's `ref(...)` or `computed(...)`. It now answers only refs from vue / javascript / typescript / tsx / jsx files. mealie: 6 Python calls reroute to the Python class; halo, elk, element-plus unchanged. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
de9f346ceb
commit
d7cdb0c09b
@@ -9,6 +9,9 @@ import { Node } from '../../types';
|
||||
import { FrameworkResolver, UnresolvedRef, ResolvedRef, ResolutionContext } from '../types';
|
||||
import { dependsOn } from './package-deps';
|
||||
|
||||
/** The languages a Vue app's scripts are written in. */
|
||||
const VUE_SCRIPT_LANGUAGES: ReadonlySet<string> = new Set(['vue', 'javascript', 'typescript', 'tsx', 'jsx']);
|
||||
|
||||
/**
|
||||
* Vue 3 compiler macros — compiler-provided, not user code
|
||||
*/
|
||||
@@ -102,6 +105,11 @@ export const vueResolver: FrameworkResolver = {
|
||||
},
|
||||
|
||||
resolve(ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | null {
|
||||
// Vue's macros, auto-imports and components are a script's, never a
|
||||
// backend's: mealie's Python `QueryFilterBuilder(...)` is not the
|
||||
// `QueryFilterBuilder.vue` component.
|
||||
if (!VUE_SCRIPT_LANGUAGES.has(ref.language)) return null;
|
||||
|
||||
// Pattern 1: Vue compiler macros (defineProps, defineEmits, etc.)
|
||||
if (VUE_COMPILER_MACROS.has(ref.referenceName)) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user