1
0
mirror of https://github.com/golang/go synced 2024-11-18 17:04:41 -07:00

internal/lsp/protocol: update to protocol version 3.15

I was messing around with the new diagnostic tags feature and
had to update to get it to work.

Change-Id: I4294513b460ec4806d23af20bf908cee8673f7c8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/197117
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Peter Weinberger <pjw@google.com>
This commit is contained in:
Rebecca Stambler 2019-09-24 17:51:00 -04:00
parent eb7cb10de1
commit 22afafe332
5 changed files with 558 additions and 557 deletions

View File

@ -196,7 +196,9 @@ func (c *connection) initialize(ctx context.Context) error {
params := &protocol.ParamInitia{}
params.RootURI = string(span.FileURI(c.Client.app.wd))
params.Capabilities.Workspace.Configuration = true
params.Capabilities.TextDocument.Hover.ContentFormat = []protocol.MarkupKind{protocol.PlainText}
params.Capabilities.TextDocument.Hover = &protocol.HoverClientCapabilities{
ContentFormat: []protocol.MarkupKind{protocol.PlainText},
}
if _, err := c.Server.Initialize(ctx, params); err != nil {
return err
}

View File

@ -53,8 +53,8 @@ func (s *Server) initialize(ctx context.Context, params *protocol.ParamInitia) (
}
var codeActionProvider interface{}
if params.Capabilities.TextDocument.CodeAction.CodeActionLiteralSupport != nil &&
len(params.Capabilities.TextDocument.CodeAction.CodeActionLiteralSupport.CodeActionKind.ValueSet) > 0 {
if ca := params.Capabilities.TextDocument.CodeAction; ca != nil && ca.CodeActionLiteralSupport != nil &&
len(ca.CodeActionLiteralSupport.CodeActionKind.ValueSet) > 0 {
// If the client has specified CodeActionLiteralSupport,
// send the code actions we support.
//
@ -66,9 +66,9 @@ func (s *Server) initialize(ctx context.Context, params *protocol.ParamInitia) (
codeActionProvider = true
}
var renameOpts interface{}
if params.Capabilities.TextDocument.Rename.PrepareSupport {
if r := params.Capabilities.TextDocument.Rename; r != nil {
renameOpts = &protocol.RenameOptions{
PrepareProvider: true,
PrepareProvider: r.PrepareSupport,
}
} else {
renameOpts = true

File diff suppressed because it is too large Load Diff

View File

@ -53,7 +53,7 @@ let fnames = [
`${srcDir}/protocol/src/protocol.ts`, `${srcDir}/types/src/main.ts`,
`${srcDir}/jsonrpc/src/main.ts`
];
let gitHash = 'fda16d6b63ba0fbdbd21d437ea810685528a0018';
let gitHash = '36ac51f057215e6e2e0408384e07ecf564a938da';
let outFname = 'tsprotocol.go';
let fda: number, fdb: number, fde: number; // file descriptors

View File

@ -143,8 +143,7 @@ func SetOptions(options *Options, opts interface{}) OptionResults {
func (o *Options) ForClientCapabilities(caps protocol.ClientCapabilities) {
// Check if the client supports snippets in completion items.
if caps.TextDocument.Completion.CompletionItem != nil &&
caps.TextDocument.Completion.CompletionItem.SnippetSupport {
if c := caps.TextDocument.Completion; c != nil && c.CompletionItem != nil && c.CompletionItem.SnippetSupport {
o.InsertTextFormat = protocol.SnippetTextFormat
}
// Check if the client supports configuration messages.
@ -153,11 +152,13 @@ func (o *Options) ForClientCapabilities(caps protocol.ClientCapabilities) {
o.DynamicWatchedFilesSupported = caps.Workspace.DidChangeWatchedFiles.DynamicRegistration
// Check which types of content format are supported by this client.
if len(caps.TextDocument.Hover.ContentFormat) > 0 {
o.PreferredContentFormat = caps.TextDocument.Hover.ContentFormat[0]
if hover := caps.TextDocument.Hover; hover != nil && len(hover.ContentFormat) > 0 {
o.PreferredContentFormat = hover.ContentFormat[0]
}
// Check if the client supports only line folding.
o.LineFoldingOnly = caps.TextDocument.FoldingRange.LineFoldingOnly
if fr := caps.TextDocument.FoldingRange; fr != nil {
o.LineFoldingOnly = fr.LineFoldingOnly
}
}
func (o *Options) set(name string, value interface{}) OptionResult {