mirror of https://github.com/golang/go.git
internal/lsp/cache: remove unused code
Change-Id: I7bafb1555ab7d35b9c49138c915b6c6c781e92c6 Reviewed-on: https://go-review.googlesource.com/c/tools/+/392656 Trust: Hyang-Ah Hana Kim <hyangah@gmail.com> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
85d68bc98d
commit
877ec07e2d
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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{} {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in New Issue