diff --git a/internal/lsp/cache/session.go b/internal/lsp/cache/session.go index aece595d2c..d421b34fcf 100644 --- a/internal/lsp/cache/session.go +++ b/internal/lsp/cache/session.go @@ -279,7 +279,7 @@ func (s *session) DidModifyFile(ctx context.Context, c source.FileModification) } } // Make sure that the file is added to the view. - f, err := view.getFileLocked(c.URI) + f, err := view.getFile(c.URI) if err != nil { return nil, err } diff --git a/internal/lsp/cache/snapshot.go b/internal/lsp/cache/snapshot.go index d24c9bc720..f2d660203d 100644 --- a/internal/lsp/cache/snapshot.go +++ b/internal/lsp/cache/snapshot.go @@ -533,7 +533,7 @@ func (s *snapshot) getFileURIs() []span.URI { // GetFile returns a File for the given URI. It will always succeed because it // adds the file to the managed set if needed. func (s *snapshot) GetFile(uri span.URI) (source.FileHandle, error) { - f, err := s.view.getFileLocked(uri) + f, err := s.view.getFile(uri) if err != nil { return nil, err } diff --git a/internal/lsp/cache/view.go b/internal/lsp/cache/view.go index c43d986cf0..1bb84c8f49 100644 --- a/internal/lsp/cache/view.go +++ b/internal/lsp/cache/view.go @@ -403,17 +403,12 @@ func (v *view) knownFile(uri span.URI) bool { return f != nil && err == nil } -// getFileLocked returns a File for the given URI. It will always succeed because it +// getFile returns a file for the given URI. It will always succeed because it // adds the file to the managed set if needed. -func (v *view) getFileLocked(uri span.URI) (*fileBase, error) { +func (v *view) getFile(uri span.URI) (*fileBase, error) { v.mu.Lock() defer v.mu.Unlock() - return v.getFile(uri) -} - -// getFile is the unlocked internal implementation of GetFile. -func (v *view) getFile(uri span.URI) (*fileBase, error) { f, err := v.findFile(uri) if err != nil { return nil, err