@@ -15,10 +15,39 @@ import type {SymbolMatch} from './types.js';
1515 * - "UserService.findById" → child "findById" of "UserService"
1616 * - "findById" → first top-level symbol named "findById"
1717 */
18+ /**
19+ * Strip surrounding quotes from a string (single or double).
20+ * E.g., "'./augmented'" → "./augmented", "\"foo\"" → "foo"
21+ */
22+ function stripQuotes ( s : string ) : string {
23+ if (
24+ ( s . startsWith ( "'" ) && s . endsWith ( "'" ) ) ||
25+ ( s . startsWith ( '"' ) && s . endsWith ( '"' ) )
26+ ) {
27+ return s . slice ( 1 , - 1 ) ;
28+ }
29+ return s ;
30+ }
31+
32+ /**
33+ * Match a symbol name against a target, handling quoted module names.
34+ */
35+ function nameMatches ( symbolName : string , targetName : string ) : boolean {
36+ if ( symbolName === targetName ) return true ;
37+ return stripQuotes ( symbolName ) === stripQuotes ( targetName ) ;
38+ }
39+
1840export function resolveSymbolTarget (
1941 symbols : FileSymbol [ ] ,
2042 target : string ,
2143) : SymbolMatch | undefined {
44+ // First, try exact match at top level (handles module names with dots like './augmented')
45+ const exactMatch = symbols . find ( s => nameMatches ( s . name , target ) ) ;
46+ if ( exactMatch ) {
47+ return { symbol : exactMatch , parent : undefined , path : [ target ] } ;
48+ }
49+
50+ // Then try dot-path resolution for nested symbols
2251 const segments = target . split ( '.' ) ;
2352
2453 let currentList = symbols ;
@@ -27,7 +56,7 @@ export function resolveSymbolTarget(
2756
2857 for ( let i = 0 ; i < segments . length ; i ++ ) {
2958 const name = segments [ i ] ;
30- const found = currentList . find ( s => s . name === name ) ;
59+ const found = currentList . find ( s => nameMatches ( s . name , name ) ) ;
3160 if ( ! found ) return undefined ;
3261
3362 pathSoFar . push ( name ) ;
0 commit comments