Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions pkg/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"errors"
"fmt"
"os"
"path/filepath"
"strings"
"sync"

Expand Down Expand Up @@ -56,11 +55,9 @@ func (c *Cache) Put(new *Document) error {
c.docs[uri] = new

// Invalidate the TopLevelObject cache
for k := range c.topLevelObjects {
if strings.HasSuffix(k, filepath.Base(uri.SpanURI().Filename())) {
delete(c.topLevelObjects, k)
}
}
// We can't easily invalidate the cache for a single file (hard to figure out where the import actually leads),
// so we just clear the whole thing
c.topLevelObjects = make(map[string][]*ast.DesugaredObject)

return nil
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ func (s *Server) DidChange(_ context.Context, params *protocol.DidChangeTextDocu
}
}
}
return nil

return s.cache.Put(doc)
}

func (s *Server) DidOpen(_ context.Context, params *protocol.DidOpenTextDocumentParams) (err error) {
Expand Down