From 11f6c2ac6da0a7bed16b75c2916850e01c725256 Mon Sep 17 00:00:00 2001 From: Rebecca Stambler Date: Tue, 28 Jan 2020 20:38:33 -0500 Subject: [PATCH] internal/lsp/cache: delete a few unused functions Change-Id: I723ae6d2676bdbb4cfc0fec339e87604a032e807 Reviewed-on: https://go-review.googlesource.com/c/tools/+/216725 Run-TryBot: Rebecca Stambler TryBot-Result: Gobot Gobot Reviewed-by: Heschi Kreinick --- internal/lsp/cache/snapshot.go | 31 +------------------------------ internal/lsp/cache/view.go | 6 ------ 2 files changed, 1 insertion(+), 36 deletions(-) diff --git a/internal/lsp/cache/snapshot.go b/internal/lsp/cache/snapshot.go index ce3641fa90..4d915e240a 100644 --- a/internal/lsp/cache/snapshot.go +++ b/internal/lsp/cache/snapshot.go @@ -480,13 +480,6 @@ func (s *snapshot) addID(uri span.URI, id packageID) { s.ids[uri] = append(s.ids[uri], id) } -func (s *snapshot) getIDs(uri span.URI) []packageID { - s.mu.Lock() - defer s.mu.Unlock() - - return s.ids[uri] -} - func (s *snapshot) isWorkspacePackage(id packageID) (packagePath, bool) { s.mu.Lock() defer s.mu.Unlock() @@ -495,17 +488,6 @@ func (s *snapshot) isWorkspacePackage(id packageID) (packagePath, bool) { return scope, ok } -func (s *snapshot) getFileURIs() []span.URI { - s.mu.Lock() - defer s.mu.Unlock() - - var uris []span.URI - for uri := range s.files { - uris = append(uris, uri) - } - return uris -} - // 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) { @@ -513,24 +495,13 @@ func (s *snapshot) GetFile(uri span.URI) (source.FileHandle, error) { if err != nil { return nil, err } - return s.getFileHandle(f), nil -} - -func (s *snapshot) getFileHandle(f *fileBase) source.FileHandle { s.mu.Lock() defer s.mu.Unlock() if _, ok := s.files[f.URI()]; !ok { s.files[f.URI()] = s.view.session.GetFile(f.URI()) } - return s.files[f.URI()] -} - -func (s *snapshot) findFileHandle(f *fileBase) source.FileHandle { - s.mu.Lock() - defer s.mu.Unlock() - - return s.files[f.URI()] + return s.files[f.URI()], nil } func (s *snapshot) awaitLoaded(ctx context.Context) error { diff --git a/internal/lsp/cache/view.go b/internal/lsp/cache/view.go index 8ab09ccd21..722ef4b2e9 100644 --- a/internal/lsp/cache/view.go +++ b/internal/lsp/cache/view.go @@ -404,12 +404,6 @@ func (v *view) buildProcessEnv(ctx context.Context) (*imports.ProcessEnv, error) return env, nil } -func (v *view) fileVersion(filename string) string { - uri := span.FileURI(filename) - fh := v.session.GetFile(uri) - return fh.Identity().String() -} - func (v *view) mapFile(uri span.URI, f *fileBase) { v.filesByURI[uri] = f if f.addURI(uri) == 1 {