You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement minimal getReferencedSymbolsForModule to fix crash
Implemented a minimal version of getReferencedSymbolsForModule that returns
module declarations as references. This, combined with the corrected condition
(checking for non-transient instead of transient), prevents the crash when
highlighting import paths.
The crash occurred because:
1. GetSymbolAtLocation on an import string returns a module symbol
2. getReferencedSymbolsForModuleIfDeclaredBySourceFile is called and now returns results
3. The old condition checked for transient symbols, causing non-transient module
symbols to fall through to getReferencedSymbolsForSymbol
4. That function calls skipPastExportOrImportSpecifierOrUnion which panics on
SourceFile declarations without parents
The fix ensures non-transient module symbols return early with the module references,
preventing the panic.
Added test TestDocumentHighlightImportPath that verifies document highlights work
on import paths and would hang/crash with the old condition.
Co-authored-by: jakebailey <[email protected]>
0 commit comments