* Resolve a Razor/Blazor simple type ref through the file's `@using` * namespaces: `CatalogBrand` + `@using BlazorShared.Models` → the node whose * qualified name is `BlazorShared.Models::CatalogBrand`. Only resolves when the * `@using` set yields exactly ONE type (otherwise it stays ambigu
(ref: UnresolvedRef)
| 2143 | * through to name-matching). |
| 2144 | */ |
| 2145 | private resolveRazorUsing(ref: UnresolvedRef): ResolvedRef | null { |
| 2146 | if (ref.referenceName.includes('.') || ref.referenceName.includes('::')) return null; |
| 2147 | const usings = this.getRazorUsings(ref.filePath); |
| 2148 | if (usings.length === 0) return null; |
| 2149 | const found = new Map<string, Node>(); |
| 2150 | for (const ns of usings) { |
| 2151 | for (const cand of this.context.getNodesByQualifiedName(`${ns}::${ref.referenceName}`)) { |
| 2152 | found.set(cand.id, cand); |
| 2153 | } |
| 2154 | } |
| 2155 | if (found.size !== 1) return null; |
| 2156 | const target = found.values().next().value!; |
| 2157 | return { original: ref, targetNodeId: target.id, confidence: 0.9, resolvedBy: 'import' }; |
| 2158 | } |
| 2159 | |
| 2160 | /** |
| 2161 | * Resolve a CFML inheritance reference written as a component path (#1152). |
no test coverage detected