diff --git a/internal/lsp/cache/mod_tidy.go b/internal/lsp/cache/mod_tidy.go index f6c74c5d1b..e85f6510b0 100644 --- a/internal/lsp/cache/mod_tidy.go +++ b/internal/lsp/cache/mod_tidy.go @@ -152,21 +152,6 @@ func (s *snapshot) ModTidy(ctx context.Context, pm *source.ParsedModule) (*sourc return mth.tidy(ctx, s) } -func (s *snapshot) uriToModDecl(ctx context.Context, uri span.URI) (protocol.Range, error) { - fh, err := s.GetFile(ctx, uri) - if err != nil { - return protocol.Range{}, nil - } - pmf, err := s.ParseMod(ctx, fh) - if err != nil { - return protocol.Range{}, nil - } - if pmf.File.Module == nil || pmf.File.Module.Syntax == nil { - return protocol.Range{}, nil - } - return rangeFromPositions(pmf.Mapper, pmf.File.Module.Syntax.Start, pmf.File.Module.Syntax.End) -} - func (s *snapshot) hashImports(ctx context.Context, wsPackages []*packageHandle) (string, error) { seen := map[string]struct{}{} var imports []string diff --git a/internal/lsp/cache/snapshot.go b/internal/lsp/cache/snapshot.go index 11ef0f2b1c..900f13f286 100644 --- a/internal/lsp/cache/snapshot.go +++ b/internal/lsp/cache/snapshot.go @@ -803,13 +803,6 @@ func (s *snapshot) isActiveLocked(id PackageID, seen map[PackageID]bool) (active return false } -func (s *snapshot) getWorkspacePkgPath(id PackageID) PackagePath { - s.mu.Lock() - defer s.mu.Unlock() - - return s.workspacePackages[id] -} - const fileExtensions = "go,mod,sum,work" func (s *snapshot) fileWatchingGlobPatterns(ctx context.Context) map[string]struct{} { diff --git a/internal/lsp/cache/symbols.go b/internal/lsp/cache/symbols.go index d1ecf2a121..8310172462 100644 --- a/internal/lsp/cache/symbols.go +++ b/internal/lsp/cache/symbols.go @@ -69,7 +69,6 @@ func symbolize(ctx context.Context, snapshot *snapshot, fh source.FileHandle) ([ type symbolWalker struct { curFile *source.ParsedGoFile - pkgName string curURI protocol.DocumentURI symbols []source.Symbol firstError error diff --git a/internal/lsp/cache/view.go b/internal/lsp/cache/view.go index 13d3db3826..b34807c6ea 100644 --- a/internal/lsp/cache/view.go +++ b/internal/lsp/cache/view.go @@ -29,7 +29,6 @@ import ( "golang.org/x/tools/internal/imports" "golang.org/x/tools/internal/lsp/protocol" "golang.org/x/tools/internal/lsp/source" - "golang.org/x/tools/internal/memoize" "golang.org/x/tools/internal/span" "golang.org/x/tools/internal/xcontext" errors "golang.org/x/xerrors" @@ -139,10 +138,6 @@ const ( tempModfile ) -type builtinPackageHandle struct { - handle *memoize.Handle -} - // fileBase holds the common functionality for all files. // It is intended to be embedded in the file implementations type fileBase struct { @@ -167,33 +162,6 @@ func (f *fileBase) addURI(uri span.URI) int { func (v *View) ID() string { return v.id } -// TODO(rfindley): factor this out to use server.tempDir, and consolidate logic with tempModFile. -func tempWorkFile(workFH source.FileHandle) (tmpURI span.URI, cleanup func(), err error) { - filenameHash := hashContents([]byte(workFH.URI().Filename())) - tmpMod, err := ioutil.TempFile("", fmt.Sprintf("go.%s.*.work", filenameHash)) - if err != nil { - return "", nil, err - } - defer tmpMod.Close() - - tmpURI = span.URIFromPath(tmpMod.Name()) - - content, err := workFH.Read() - if err != nil { - return "", nil, err - } - - if _, err := tmpMod.Write(content); err != nil { - return "", nil, err - } - - cleanup = func() { - _ = os.Remove(tmpURI.Filename()) - } - - return tmpURI, cleanup, nil -} - // tempModFile creates a temporary go.mod file based on the contents of the // given go.mod file. It is the caller's responsibility to clean up the files // when they are done using them.