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>
diff --git a/gopls/internal/lsp/analysis/unusedvariable/unusedvariable.go b/gopls/internal/lsp/analysis/unusedvariable/unusedvariable.go
index 026befb..134cbb2 100644
--- a/gopls/internal/lsp/analysis/unusedvariable/unusedvariable.go
+++ b/gopls/internal/lsp/analysis/unusedvariable/unusedvariable.go
@@ -32,8 +32,6 @@
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"}
diff --git a/gopls/internal/lsp/cache/snapshot.go b/gopls/internal/lsp/cache/snapshot.go
index aa088bb..4398142 100644
--- a/gopls/internal/lsp/cache/snapshot.go
+++ b/gopls/internal/lsp/cache/snapshot.go
@@ -31,11 +31,11 @@
"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 @@
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
diff --git a/gopls/internal/lsp/cmd/export_test.go b/gopls/internal/lsp/cmd/export_test.go
deleted file mode 100644
index 05b3cd3..0000000
--- a/gopls/internal/lsp/cmd/export_test.go
+++ /dev/null
@@ -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
-)
diff --git a/gopls/internal/lsp/command/interface.go b/gopls/internal/lsp/command/interface.go
index d49a433..fc50575 100644
--- a/gopls/internal/lsp/command/interface.go
+++ b/gopls/internal/lsp/command/interface.go
@@ -272,21 +272,6 @@
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
diff --git a/gopls/internal/lsp/debug/info.go b/gopls/internal/lsp/debug/info.go
index 8784e74..00752e6 100644
--- a/gopls/internal/lsp/debug/info.go
+++ b/gopls/internal/lsp/debug/info.go
@@ -38,17 +38,6 @@
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.
diff --git a/gopls/internal/lsp/regtest/expectation.go b/gopls/internal/lsp/regtest/expectation.go
index 5234f7e..eddd813 100644
--- a/gopls/internal/lsp/regtest/expectation.go
+++ b/gopls/internal/lsp/regtest/expectation.go
@@ -678,14 +678,6 @@
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.
//
diff --git a/gopls/internal/lsp/source/options.go b/gopls/internal/lsp/source/options.go
index 110621c..93d0948 100644
--- a/gopls/internal/lsp/source/options.go
+++ b/gopls/internal/lsp/source/options.go
@@ -682,16 +682,6 @@
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) {
diff --git a/gopls/internal/lsp/template/completion.go b/gopls/internal/lsp/template/completion.go
index 7040081..140c674 100644
--- a/gopls/internal/lsp/template/completion.go
+++ b/gopls/internal/lsp/template/completion.go
@@ -285,17 +285,3 @@
}
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)
-}
diff --git a/gopls/internal/lsp/template/parse.go b/gopls/internal/lsp/template/parse.go
index f2e4f25..679bd4d 100644
--- a/gopls/internal/lsp/template/parse.go
+++ b/gopls/internal/lsp/template/parse.go
@@ -24,9 +24,9 @@
"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 @@
}
}
-// 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",
diff --git a/gopls/internal/lsp/tests/tests.go b/gopls/internal/lsp/tests/tests.go
index 253e28a..2b8e830 100644
--- a/gopls/internal/lsp/tests/tests.go
+++ b/gopls/internal/lsp/tests/tests.go
@@ -87,7 +87,6 @@
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
diff --git a/gopls/internal/lsp/work/diagnostics.go b/gopls/internal/lsp/work/diagnostics.go
index 0a38219..c383777 100644
--- a/gopls/internal/lsp/work/diagnostics.go
+++ b/gopls/internal/lsp/work/diagnostics.go
@@ -11,10 +11,10 @@
"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"
)