mirror of
https://github.com/golang/go
synced 2024-11-18 19:14:40 -07:00
cmd/gopls: fix incomplete ClientCapabilities struct
go.ts, the program that generates Go types for the LSP protocol, now handles Typescript type merging for ClientCapabilites, so fields are no longer missing. Also, to silence go lint and go vet there are changes in the comments generated in tsprotocol.go. All the *structs were changed to structs in ClientCapabilities as it was absurdly complex to write literals of the type. Finally, several otherwise unused types are no longer generated. Change-Id: If414a32bc4d733adb2cf8befda9d8a0703c568a6 Reviewed-on: https://go-review.googlesource.com/c/tools/+/171026 Run-TryBot: Peter Weinberger <pjw@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com>
This commit is contained in:
parent
e5b8258f49
commit
04e50493df
@ -152,11 +152,7 @@ func (app *Application) connect(ctx context.Context, client cmdClient) (protocol
|
|||||||
}
|
}
|
||||||
params := &protocol.InitializeParams{}
|
params := &protocol.InitializeParams{}
|
||||||
params.RootURI = string(span.FileURI(app.Config.Dir))
|
params.RootURI = string(span.FileURI(app.Config.Dir))
|
||||||
params.Capabilities = map[string]interface{}{
|
params.Capabilities.Workspace.Configuration = true
|
||||||
"workspace": map[string]interface{}{
|
|
||||||
"configuration": true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
client.prepare(app, server)
|
client.prepare(app, server)
|
||||||
if _, err := server.Initialize(ctx, params); err != nil {
|
if _, err := server.Initialize(ctx, params); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -149,54 +149,34 @@ func (s *Server) Initialize(ctx context.Context, params *protocol.InitializePara
|
|||||||
|
|
||||||
return &protocol.InitializeResult{
|
return &protocol.InitializeResult{
|
||||||
Capabilities: protocol.ServerCapabilities{
|
Capabilities: protocol.ServerCapabilities{
|
||||||
InnerServerCapabilities: protocol.InnerServerCapabilities{
|
CodeActionProvider: true,
|
||||||
CodeActionProvider: true,
|
CompletionProvider: &protocol.CompletionOptions{
|
||||||
CompletionProvider: &protocol.CompletionOptions{
|
TriggerCharacters: []string{"."},
|
||||||
TriggerCharacters: []string{"."},
|
|
||||||
},
|
|
||||||
DefinitionProvider: true,
|
|
||||||
DocumentFormattingProvider: true,
|
|
||||||
DocumentRangeFormattingProvider: true,
|
|
||||||
DocumentSymbolProvider: true,
|
|
||||||
HoverProvider: true,
|
|
||||||
DocumentHighlightProvider: true,
|
|
||||||
SignatureHelpProvider: &protocol.SignatureHelpOptions{
|
|
||||||
TriggerCharacters: []string{"(", ","},
|
|
||||||
},
|
|
||||||
TextDocumentSync: &protocol.TextDocumentSyncOptions{
|
|
||||||
Change: s.textDocumentSyncKind,
|
|
||||||
OpenClose: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
TypeDefinitionServerCapabilities: protocol.TypeDefinitionServerCapabilities{
|
DefinitionProvider: true,
|
||||||
TypeDefinitionProvider: true,
|
DocumentFormattingProvider: true,
|
||||||
|
DocumentRangeFormattingProvider: true,
|
||||||
|
DocumentSymbolProvider: true,
|
||||||
|
HoverProvider: true,
|
||||||
|
DocumentHighlightProvider: true,
|
||||||
|
SignatureHelpProvider: &protocol.SignatureHelpOptions{
|
||||||
|
TriggerCharacters: []string{"(", ","},
|
||||||
},
|
},
|
||||||
|
TextDocumentSync: &protocol.TextDocumentSyncOptions{
|
||||||
|
Change: s.textDocumentSyncKind,
|
||||||
|
OpenClose: true,
|
||||||
|
},
|
||||||
|
TypeDefinitionProvider: true,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) setClientCapabilities(caps protocol.ClientCapabilities) {
|
func (s *Server) setClientCapabilities(caps protocol.ClientCapabilities) {
|
||||||
// Check if the client supports snippets in completion items.
|
// Check if the client supports snippets in completion items.
|
||||||
if x, ok := caps["textDocument"].(map[string]interface{}); ok {
|
s.snippetsSupported = caps.TextDocument.Completion.CompletionItem.SnippetSupport
|
||||||
if x, ok := x["completion"].(map[string]interface{}); ok {
|
|
||||||
if x, ok := x["completionItem"].(map[string]interface{}); ok {
|
|
||||||
if x, ok := x["snippetSupport"].(bool); ok {
|
|
||||||
s.snippetsSupported = x
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Check if the client supports configuration messages.
|
// Check if the client supports configuration messages.
|
||||||
if x, ok := caps["workspace"].(map[string]interface{}); ok {
|
s.configurationSupported = caps.Workspace.Configuration
|
||||||
if x, ok := x["configuration"].(bool); ok {
|
s.dynamicConfigurationSupported = caps.Workspace.DidChangeConfiguration.DynamicRegistration
|
||||||
s.configurationSupported = x
|
|
||||||
}
|
|
||||||
if x, ok := x["didChangeConfiguration"].(map[string]interface{}); ok {
|
|
||||||
if x, ok := x["dynamicRegistration"].(bool); ok {
|
|
||||||
s.dynamicConfigurationSupported = x
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) Initialized(ctx context.Context, params *protocol.InitializedParams) error {
|
func (s *Server) Initialized(ctx context.Context, params *protocol.InitializedParams) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user