gopls/internal/lsp: delete dead code

Delete some gopls code that is no longer used.

Change-Id: Ib211b01b6c2ac8a03700b1e47d32ac69fccd1b83
Reviewed-on: https://go-review.googlesource.com/c/tools/+/435360
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Robert Findley 2022-09-28 12:03:51 -04:00
parent ae737bc619
commit 9c63911fcf
11 changed files with 7 additions and 97 deletions

View File

@ -32,8 +32,6 @@ var Analyzer = &analysis.Analyzer{
RunDespiteErrors: true, // an unusedvariable diagnostic is a compile error
}
type fixesForError map[types.Error][]analysis.SuggestedFix
// The suffix for this error message changed in Go 1.20.
var unusedVariableSuffixes = []string{" declared and not used", " declared but not used"}

View File

@ -31,11 +31,11 @@ import (
"golang.org/x/mod/semver"
"golang.org/x/sync/errgroup"
"golang.org/x/tools/go/packages"
"golang.org/x/tools/internal/event"
"golang.org/x/tools/internal/gocommand"
"golang.org/x/tools/internal/bug"
"golang.org/x/tools/internal/event/tag"
"golang.org/x/tools/gopls/internal/lsp/source"
"golang.org/x/tools/internal/bug"
"golang.org/x/tools/internal/event"
"golang.org/x/tools/internal/event/tag"
"golang.org/x/tools/internal/gocommand"
"golang.org/x/tools/internal/memoize"
"golang.org/x/tools/internal/packagesinternal"
"golang.org/x/tools/internal/persistent"
@ -1612,15 +1612,6 @@ func (s *snapshot) orphanedFiles() []source.VersionedFileHandle {
return files
}
func contains(views []*View, view *View) bool {
for _, v := range views {
if v == view {
return true
}
}
return false
}
// TODO(golang/go#53756): this function needs to consider more than just the
// absolute URI, for example:
// - the position of /vendor/ with respect to the relevant module root

View File

@ -1,11 +0,0 @@
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cmd
const (
ExampleLine = exampleLine
ExampleColumn = exampleColumn
ExampleOffset = exampleOffset
)

View File

@ -272,21 +272,6 @@ type PackageImport struct {
Path string
}
type WorkspaceMetadataArgs struct {
}
type WorkspaceMetadataResult struct {
// All workspaces for this session.
Workspaces []Workspace
}
type Workspace struct {
// The workspace name.
Name string
// The workspace module directory.
ModuleDir string
}
type DebuggingArgs struct {
// Optional: the address (including port) for the debug server to listen on.
// If not provided, the debug server will bind to "localhost:0", and the

View File

@ -38,17 +38,6 @@ type ServerVersion struct {
Version string
}
type Module struct {
ModuleVersion
Replace *ModuleVersion `json:"replace,omitempty"`
}
type ModuleVersion struct {
Path string `json:"path,omitempty"`
Version string `json:"version,omitempty"`
Sum string `json:"sum,omitempty"`
}
// VersionInfo returns the build info for the gopls process. If it was not
// built in module mode, we return a GOPATH-specific message with the
// hardcoded version.

View File

@ -678,14 +678,6 @@ func (e *Env) NoDiagnosticAtRegexp(name, re string) DiagnosticExpectation {
return DiagnosticExpectation{path: name, pos: &pos, re: re, present: false}
}
// NoDiagnosticAt asserts that there is no diagnostic entry at the position
// specified by line and col, for the workdir-relative path name.
// This should only be used in combination with OnceMet for a given condition,
// otherwise it may always succeed.
func NoDiagnosticAt(name string, line, col int) DiagnosticExpectation {
return DiagnosticExpectation{path: name, pos: &fake.Pos{Line: line, Column: col}, present: false}
}
// NoDiagnosticWithMessage asserts that there is no diagnostic entry with the
// given message.
//

View File

@ -682,16 +682,6 @@ type OptionResult struct {
Error error
}
type OptionState int
const (
OptionHandled = OptionState(iota)
OptionDeprecated
OptionUnexpected
)
type LinkTarget string
func SetOptions(options *Options, opts interface{}) OptionResults {
var results OptionResults
switch opts := opts.(type) {

View File

@ -285,17 +285,3 @@ func weakMatch(choice, pattern string) float64 {
}
return 1
}
// for debug printing
func strContext(c protocol.CompletionContext) string {
switch c.TriggerKind {
case protocol.Invoked:
return "invoked"
case protocol.TriggerCharacter:
return fmt.Sprintf("triggered(%s)", c.TriggerCharacter)
case protocol.TriggerForIncompleteCompletions:
// gopls doesn't seem to handle these explicitly anywhere
return "incomplete"
}
return fmt.Sprintf("?%v", c)
}

View File

@ -24,9 +24,9 @@ import (
"text/template/parse"
"unicode/utf8"
"golang.org/x/tools/internal/event"
"golang.org/x/tools/gopls/internal/lsp/protocol"
"golang.org/x/tools/gopls/internal/lsp/source"
"golang.org/x/tools/internal/event"
"golang.org/x/tools/internal/span"
)
@ -492,15 +492,6 @@ func (wr wrNode) writeNode(n parse.Node, indent string) {
}
}
// short prints at most 40 bytes of node.String(), for debugging
func short(n parse.Node) string {
s := fmt.Sprint(n) // recovers from panic
if len(s) > 40 {
return s[:40] + "..."
}
return s
}
var kindNames = []string{"", "File", "Module", "Namespace", "Package", "Class", "Method", "Property",
"Field", "Constructor", "Enum", "Interface", "Function", "Variable", "Constant", "String",
"Number", "Boolean", "Array", "Object", "Key", "Null", "EnumMember", "Struct", "Event",

View File

@ -87,7 +87,6 @@ type References = map[span.Span][]span.Span
type Renames = map[span.Span]string
type PrepareRenames = map[span.Span]*source.PrepareItem
type Symbols = map[span.URI][]*symbol
type SymbolInformation = map[span.Span]protocol.SymbolInformation
type InlayHints = []span.Span
type WorkspaceSymbols = map[WorkspaceSymbolsTestType]map[span.URI][]string
type Signatures = map[span.Span]*protocol.SignatureHelp

View File

@ -11,10 +11,10 @@ import (
"path/filepath"
"golang.org/x/mod/modfile"
"golang.org/x/tools/internal/event"
"golang.org/x/tools/internal/event/tag"
"golang.org/x/tools/gopls/internal/lsp/protocol"
"golang.org/x/tools/gopls/internal/lsp/source"
"golang.org/x/tools/internal/event"
"golang.org/x/tools/internal/event/tag"
"golang.org/x/tools/internal/span"
)