diff --git a/gopls/internal/lsp/analysis/unusedvariable/unusedvariable.go b/gopls/internal/lsp/analysis/unusedvariable/unusedvariable.go index 026befb7df..134cbb2c43 100644 --- a/gopls/internal/lsp/analysis/unusedvariable/unusedvariable.go +++ b/gopls/internal/lsp/analysis/unusedvariable/unusedvariable.go @@ -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"} diff --git a/gopls/internal/lsp/cache/snapshot.go b/gopls/internal/lsp/cache/snapshot.go index aa088bb408..4398142eb0 100644 --- a/gopls/internal/lsp/cache/snapshot.go +++ b/gopls/internal/lsp/cache/snapshot.go @@ -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 diff --git a/gopls/internal/lsp/cmd/export_test.go b/gopls/internal/lsp/cmd/export_test.go deleted file mode 100644 index 05b3cd3126..0000000000 --- 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 d49a4330d8..fc5057580f 100644 --- a/gopls/internal/lsp/command/interface.go +++ b/gopls/internal/lsp/command/interface.go @@ -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 diff --git a/gopls/internal/lsp/debug/info.go b/gopls/internal/lsp/debug/info.go index 8784e7455b..00752e6f9a 100644 --- a/gopls/internal/lsp/debug/info.go +++ b/gopls/internal/lsp/debug/info.go @@ -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. diff --git a/gopls/internal/lsp/regtest/expectation.go b/gopls/internal/lsp/regtest/expectation.go index 5234f7e9b9..eddd8136fd 100644 --- a/gopls/internal/lsp/regtest/expectation.go +++ b/gopls/internal/lsp/regtest/expectation.go @@ -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. // diff --git a/gopls/internal/lsp/source/options.go b/gopls/internal/lsp/source/options.go index 110621c26b..93d09489e7 100644 --- a/gopls/internal/lsp/source/options.go +++ b/gopls/internal/lsp/source/options.go @@ -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) { diff --git a/gopls/internal/lsp/template/completion.go b/gopls/internal/lsp/template/completion.go index 7040081e8a..140c674747 100644 --- a/gopls/internal/lsp/template/completion.go +++ b/gopls/internal/lsp/template/completion.go @@ -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) -} diff --git a/gopls/internal/lsp/template/parse.go b/gopls/internal/lsp/template/parse.go index f2e4f25bff..679bd4d16a 100644 --- a/gopls/internal/lsp/template/parse.go +++ b/gopls/internal/lsp/template/parse.go @@ -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", diff --git a/gopls/internal/lsp/tests/tests.go b/gopls/internal/lsp/tests/tests.go index 253e28aaf9..2b8e8300af 100644 --- a/gopls/internal/lsp/tests/tests.go +++ b/gopls/internal/lsp/tests/tests.go @@ -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 diff --git a/gopls/internal/lsp/work/diagnostics.go b/gopls/internal/lsp/work/diagnostics.go index 0a382194a4..c383777438 100644 --- a/gopls/internal/lsp/work/diagnostics.go +++ b/gopls/internal/lsp/work/diagnostics.go @@ -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" )