@@ -60,8 +60,8 @@ type file struct {
6060 workspace * workspace // May be nil.
6161 objectInfo storage.ObjectInfo // Info in the context of the workspace.
6262
63- ir ir.File
64- referenceableSymbols map [string ]* symbol
63+ ir * ir.File
64+ referenceableSymbols map [report. Span ]* symbol
6565 referenceSymbols []* symbol
6666 symbols []* symbol
6767 diagnostics []protocol.Diagnostic
@@ -215,7 +215,7 @@ func (f *file) RefreshIR(ctx context.Context) {
215215 slog .Int ("version" , int (f .version )),
216216 )
217217 f .diagnostics = nil
218- f .ir = ir. File {}
218+ f .ir = nil
219219
220220 // Opener creates a cached view of all files in the workspace.
221221 pathToFiles := f .workspace .PathToFile ()
@@ -228,7 +228,7 @@ func (f *file) RefreshIR(ctx context.Context) {
228228 opener := source .NewMap (openerMap )
229229
230230 session := new (ir.Session )
231- queries := xslices .Map (files , func (file * file ) incremental.Query [ir.File ] {
231+ queries := xslices .Map (files , func (file * file ) incremental.Query [* ir.File ] {
232232 return queries.IR {
233233 Opener : opener ,
234234 Path : file .objectInfo .Path (),
@@ -285,15 +285,15 @@ func (f *file) RefreshIR(ctx context.Context) {
285285func (f * file ) IndexSymbols (ctx context.Context ) {
286286 defer xslog .DebugProfile (f .lsp .logger , slog .String ("uri" , string (f .uri )))()
287287 // We cannot index symbols without the IR, so we keep the symbols as-is.
288- if f .ir . IsZero () {
288+ if f .ir == nil {
289289 return
290290 }
291291
292292 // Throw away all the old symbols and rebuild symbols unconditionally. This is because if
293293 // this file depends on a file that has since been modified, we may need to update references.
294294 f .symbols = nil
295295 f .referenceSymbols = nil
296- f .referenceableSymbols = make (map [string ]* symbol )
296+ f .referenceableSymbols = make (map [report. Span ]* symbol )
297297
298298 // Process all imports as symbols
299299 for imp := range seq .Values (f .ir .Imports ()) {
@@ -311,7 +311,7 @@ func (f *file) IndexSymbols(ctx context.Context) {
311311 if ! ok {
312312 continue
313313 }
314- f .referenceableSymbols [def .ast .Name ().Canonicalized ()] = sym
314+ f .referenceableSymbols [def .ast .Name ().Span ()] = sym
315315 }
316316
317317 // TODO: this could use a refactor, probably.
@@ -338,7 +338,7 @@ func (f *file) IndexSymbols(ctx context.Context) {
338338 }
339339 file = f
340340 }
341- def , ok := file .referenceableSymbols [ref .def .Name ().Canonicalized ()]
341+ def , ok := file .referenceableSymbols [ref .def .Name ().Span ()]
342342 if ! ok {
343343 // This could happen in the case where we are in the cache for example, and we do not
344344 // have access to a buildable workspace.
@@ -377,7 +377,7 @@ func (f *file) IndexSymbols(ctx context.Context) {
377377 if ref .def .Span ().Path () != f .objectInfo .Path () {
378378 continue
379379 }
380- def , ok := f .referenceableSymbols [ref .def .Name ().Canonicalized ()]
380+ def , ok := f .referenceableSymbols [ref .def .Name ().Span ()]
381381 if ! ok {
382382 // This shouldn't happen, if a symbol is pointing at this file, all definitions
383383 // should be resolved, logging a warning
@@ -425,7 +425,7 @@ func (f *file) indexSymbols() ([]*symbol, []*symbol) {
425425 for i := range f .ir .Symbols ().Len () {
426426 // We only index the symbols for this file.
427427 symbol := f .ir .Symbols ().At (i )
428- if symbol .File ().Path () != f .objectInfo .Path () {
428+ if symbol .Context ().Path () != f .objectInfo .Path () {
429429 continue
430430 }
431431 resolvedSyms , unresolvedSyms := f .irToSymbols (symbol )
@@ -831,7 +831,7 @@ type wktObjectInfo struct {
831831// This operation requires [IndexSymbols].
832832func (f * file ) GetSymbols (query string ) iter.Seq [protocol.SymbolInformation ] {
833833 return func (yield func (protocol.SymbolInformation ) bool ) {
834- if f .ir . IsZero () {
834+ if f .ir == nil {
835835 return
836836 }
837837 // Search through all symbols in this file.
0 commit comments