Rebecca Stambler submitted this change.
1 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: internal/lsp/general.go
Insertions: 0, Deletions: 6.
@@ -195,12 +195,6 @@
Method: "workspace/didChangeConfiguration",
})
}
- if options.WorkspaceFoldersSupported {
- registrations = append(registrations, protocol.Registration{
- ID: "workspace/didChangeWorkspaceFolders",
- Method: "workspace/didChangeWorkspaceFolders",
- })
- }
if options.SemanticTokens && options.DynamicRegistrationSemanticTokensSupported {
registrations = append(registrations, semanticTokenRegistration(options.SemanticTypes, options.SemanticMods))
}
```
```
The name of the file: internal/lsp/source/options.go
Insertions: 0, Deletions: 3.
@@ -49,7 +49,7 @@
"golang.org/x/tools/go/analysis/passes/unusedwrite"
"golang.org/x/tools/internal/lsp/analysis/fillreturns"
"golang.org/x/tools/internal/lsp/analysis/fillstruct"
- "golang.org/x/tools/internal/lsp/analysis/implementmissing"
+ "golang.org/x/tools/internal/lsp/analysis/infertypeargs"
"golang.org/x/tools/internal/lsp/analysis/nonewvars"
"golang.org/x/tools/internal/lsp/analysis/noresultvalues"
"golang.org/x/tools/internal/lsp/analysis/simplifycompositelit"
@@ -87,7 +87,6 @@
DynamicConfigurationSupported: true,
DynamicRegistrationSemanticTokensSupported: true,
DynamicWatchedFilesSupported: true,
- WorkspaceFoldersSupported: true,
LineFoldingOnly: false,
HierarchicalDocumentSymbolSupport: true,
},
@@ -190,7 +189,6 @@
DynamicConfigurationSupported bool
DynamicRegistrationSemanticTokensSupported bool
DynamicWatchedFilesSupported bool
- WorkspaceFoldersSupported bool
PreferredContentFormat protocol.MarkupKind
LineFoldingOnly bool
HierarchicalDocumentSymbolSupport bool
@@ -661,7 +659,6 @@
o.DynamicConfigurationSupported = caps.Workspace.DidChangeConfiguration.DynamicRegistration
o.DynamicRegistrationSemanticTokensSupported = caps.TextDocument.SemanticTokens.DynamicRegistration
o.DynamicWatchedFilesSupported = caps.Workspace.DidChangeWatchedFiles.DynamicRegistration
- o.WorkspaceFoldersSupported = caps.Workspace.WorkspaceFolders
// Check which types of content format are supported by this client.
if hover := caps.TextDocument.Hover; len(hover.ContentFormat) > 0 {
@@ -762,9 +759,6 @@
if _, ok := o.Analyses[unusedparams.Analyzer.Name]; !ok {
o.Analyses[unusedparams.Analyzer.Name] = true
}
- if _, ok := o.Analyses[implementmissing.Analyzer.Name]; !ok {
- o.Analyses[implementmissing.Analyzer.Name] = true
- }
}
func (o *Options) set(name string, value interface{}, seen map[string]struct{}) OptionResult {
@@ -1182,11 +1176,6 @@
ActionKind: []protocol.CodeActionKind{protocol.SourceFixAll, protocol.QuickFix},
Enabled: true,
},
- implementmissing.Analyzer.Name: {
- Analyzer: implementmissing.Analyzer,
- ActionKind: []protocol.CodeActionKind{protocol.SourceFixAll, protocol.QuickFix},
- Enabled: false,
- },
nonewvars.Analyzer.Name: {
Analyzer: nonewvars.Analyzer,
Enabled: true,
@@ -1253,6 +1242,7 @@
unusedparams.Analyzer.Name: {Analyzer: unusedparams.Analyzer, Enabled: false},
unusedwrite.Analyzer.Name: {Analyzer: unusedwrite.Analyzer, Enabled: false},
useany.Analyzer.Name: {Analyzer: useany.Analyzer, Enabled: true},
+ infertypeargs.Analyzer.Name: {Analyzer: infertypeargs.Analyzer, Enabled: true},
// gofmt -s suite:
simplifycompositelit.Analyzer.Name: {
```
internal/lsp: use the correct dynamic registration booleans
I mistakenly used DynamicConfigurationSupported for all capabilities,
not just the workspace/configuration one.
Fixes golang/go#48600
Change-Id: Ie9b205d89da6e4d110a5310b31fc1ba22f2b5383
Reviewed-on: https://go-review.googlesource.com/c/tools/+/352055
Trust: Rebecca Stambler <rsta...@golang.org>
Run-TryBot: Rebecca Stambler <rsta...@golang.org>
gopls-CI: kokoro <noreply...@google.com>
TryBot-Result: Go Bot <go...@golang.org>
Reviewed-by: Robert Findley <rfin...@google.com>
---
M internal/lsp/general.go
M internal/lsp/source/options.go
2 files changed, 52 insertions(+), 32 deletions(-)
diff --git a/internal/lsp/general.go b/internal/lsp/general.go
index 3c409d3..e699188 100644
--- a/internal/lsp/general.go
+++ b/internal/lsp/general.go
@@ -188,20 +188,17 @@
}
s.pendingFolders = nil
+ var registrations []protocol.Registration
if options.ConfigurationSupported && options.DynamicConfigurationSupported {
- registrations := []protocol.Registration{
- {
- ID: "workspace/didChangeConfiguration",
- Method: "workspace/didChangeConfiguration",
- },
- {
- ID: "workspace/didChangeWorkspaceFolders",
- Method: "workspace/didChangeWorkspaceFolders",
- },
- }
- if options.SemanticTokens {
- registrations = append(registrations, semanticTokenRegistration(options.SemanticTypes, options.SemanticMods))
- }
+ registrations = append(registrations, protocol.Registration{
+ ID: "workspace/didChangeConfiguration",
+ Method: "workspace/didChangeConfiguration",
+ })
+ }
+ if options.SemanticTokens && options.DynamicRegistrationSemanticTokensSupported {
+ registrations = append(registrations, semanticTokenRegistration(options.SemanticTypes, options.SemanticMods))
+ }
+ if len(registrations) > 0 {
if err := s.client.RegisterCapability(ctx, &protocol.RegistrationParams{
Registrations: registrations,
}); err != nil {
diff --git a/internal/lsp/source/options.go b/internal/lsp/source/options.go
index cb4b11d..4875111 100644
--- a/internal/lsp/source/options.go
+++ b/internal/lsp/source/options.go
@@ -81,13 +81,14 @@
}
defaultOptions = &Options{
ClientOptions: ClientOptions{
- InsertTextFormat: protocol.PlainTextTextFormat,
- PreferredContentFormat: protocol.Markdown,
- ConfigurationSupported: true,
- DynamicConfigurationSupported: true,
- DynamicWatchedFilesSupported: true,
- LineFoldingOnly: false,
- HierarchicalDocumentSymbolSupport: true,
+ InsertTextFormat: protocol.PlainTextTextFormat,
+ PreferredContentFormat: protocol.Markdown,
+ ConfigurationSupported: true,
+ DynamicConfigurationSupported: true,
+ DynamicRegistrationSemanticTokensSupported: true,
+ DynamicWatchedFilesSupported: true,
+ LineFoldingOnly: false,
+ HierarchicalDocumentSymbolSupport: true,
},
ServerOptions: ServerOptions{
SupportedCodeActions: map[FileKind]map[protocol.CodeActionKind]bool{
@@ -183,18 +184,19 @@
// ClientOptions holds LSP-specific configuration that is provided by the
// client.
type ClientOptions struct {
- InsertTextFormat protocol.InsertTextFormat
- ConfigurationSupported bool
- DynamicConfigurationSupported bool
- DynamicWatchedFilesSupported bool
- PreferredContentFormat protocol.MarkupKind
- LineFoldingOnly bool
- HierarchicalDocumentSymbolSupport bool
- SemanticTypes []string
- SemanticMods []string
- RelatedInformationSupported bool
- CompletionTags bool
- CompletionDeprecated bool
+ InsertTextFormat protocol.InsertTextFormat
+ ConfigurationSupported bool
+ DynamicConfigurationSupported bool
+ DynamicRegistrationSemanticTokensSupported bool
+ DynamicWatchedFilesSupported bool
+ PreferredContentFormat protocol.MarkupKind
+ LineFoldingOnly bool
+ HierarchicalDocumentSymbolSupport bool
+ SemanticTypes []string
+ SemanticMods []string
+ RelatedInformationSupported bool
+ CompletionTags bool
+ CompletionDeprecated bool
}
// ServerOptions holds LSP-specific configuration that is provided by the
@@ -655,6 +657,7 @@
// Check if the client supports configuration messages.
o.ConfigurationSupported = caps.Workspace.Configuration
o.DynamicConfigurationSupported = caps.Workspace.DidChangeConfiguration.DynamicRegistration
+ o.DynamicRegistrationSemanticTokensSupported = caps.TextDocument.SemanticTokens.DynamicRegistration
o.DynamicWatchedFilesSupported = caps.Workspace.DidChangeWatchedFiles.DynamicRegistration
// Check which types of content format are supported by this client.
To view, visit change 352055. To unsubscribe, or for help writing mail filters, visit settings.