internal/lsp: update the generated lsp protocol
Change-Id: Ic30a6e9e49a67f93419547ea2c61d87109959393 Reviewed-on: https://go-review.googlesource.com/c/tools/+/185777 Run-TryBot: Ian Cottrell <iancottrell@google.com> Reviewed-by: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
9c57229d8a
commit
9a621aea19
|
@ -13,6 +13,8 @@ import (
|
||||||
"golang.org/x/tools/internal/xcontext"
|
"golang.org/x/tools/internal/xcontext"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type DocumentUri = string
|
||||||
|
|
||||||
const defaultMessageBufferSize = 20
|
const defaultMessageBufferSize = 20
|
||||||
const defaultRejectIfOverloaded = false
|
const defaultRejectIfOverloaded = false
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Package protocol contains data types and code for LSP jsonrpcs
|
// Package protocol contains data types and code for LSP jsonrpcs
|
||||||
// generated automatically from vscode-languageserver-node
|
// generated automatically from vscode-languageserver-node
|
||||||
// commit: c1e8923f8ea3b1f9c61dadf97448244d9ffbf7ae
|
// commit: 8801c20b667945f455d7e023c71d2f741caeda25
|
||||||
// last fetched Tue May 21 2019 07:36:27 GMT-0400 (Eastern Daylight Time)
|
// last fetched Thu Jul 11 2019 13:43:41 GMT-0400 (Eastern Daylight Time)
|
||||||
package protocol
|
package protocol
|
||||||
|
|
||||||
// Code generated (see typescript/README.md) DO NOT EDIT.
|
// Code generated (see typescript/README.md) DO NOT EDIT.
|
||||||
|
@ -155,6 +155,26 @@ type FoldingRangeParams struct {
|
||||||
TextDocument TextDocumentIdentifier `json:"textDocument"`
|
TextDocument TextDocumentIdentifier `json:"textDocument"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SelectionRangeProviderOptions is
|
||||||
|
type SelectionRangeProviderOptions struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
/*SelectionRangeParams defined:
|
||||||
|
* A parameter literal used in selection range requests.
|
||||||
|
*/
|
||||||
|
type SelectionRangeParams struct {
|
||||||
|
|
||||||
|
/*TextDocument defined:
|
||||||
|
* The text document.
|
||||||
|
*/
|
||||||
|
TextDocument TextDocumentIdentifier `json:"textDocument"`
|
||||||
|
|
||||||
|
/*Positions defined:
|
||||||
|
* The positions inside the text document.
|
||||||
|
*/
|
||||||
|
Positions []Position `json:"positions"`
|
||||||
|
}
|
||||||
|
|
||||||
/*Registration defined:
|
/*Registration defined:
|
||||||
* General parameters to to register for an notification or to register a provider.
|
* General parameters to to register for an notification or to register a provider.
|
||||||
*/
|
*/
|
||||||
|
@ -1241,6 +1261,19 @@ type ClientCapabilities struct {
|
||||||
*/
|
*/
|
||||||
LinkSupport bool `json:"linkSupport,omitempty"`
|
LinkSupport bool `json:"linkSupport,omitempty"`
|
||||||
} `json:"declaration,omitempty"`
|
} `json:"declaration,omitempty"`
|
||||||
|
|
||||||
|
/*SelectionRange defined:
|
||||||
|
* Capabilities specific to `textDocument/selectionRange` requests
|
||||||
|
*/
|
||||||
|
SelectionRange struct {
|
||||||
|
|
||||||
|
/*DynamicRegistration defined:
|
||||||
|
* Whether implementation supports dynamic registration for selection range providers. If this is set to `true`
|
||||||
|
* the client supports the new `(SelectionRangeProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)`
|
||||||
|
* return value for the corresponding server capability as well.
|
||||||
|
*/
|
||||||
|
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
|
||||||
|
} `json:"selectionRange,omitempty"`
|
||||||
} `json:"textDocument,omitempty"`
|
} `json:"textDocument,omitempty"`
|
||||||
|
|
||||||
/*Window defined:
|
/*Window defined:
|
||||||
|
@ -1600,6 +1633,11 @@ type ServerCapabilities struct {
|
||||||
* The server provides Goto Type Definition support.
|
* The server provides Goto Type Definition support.
|
||||||
*/
|
*/
|
||||||
DeclarationProvider bool `json:"declarationProvider,omitempty"` // boolean | (TextDocumentRegistrationOptions & StaticRegistrationOptions)
|
DeclarationProvider bool `json:"declarationProvider,omitempty"` // boolean | (TextDocumentRegistrationOptions & StaticRegistrationOptions)
|
||||||
|
|
||||||
|
/*SelectionRangeProvider defined:
|
||||||
|
* The server provides selection range support.
|
||||||
|
*/
|
||||||
|
SelectionRangeProvider bool `json:"selectionRangeProvider,omitempty"` // boolean | (TextDocumentRegistrationOptions & StaticRegistrationOptions & SelectionRangeProviderOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitializeParams is
|
// InitializeParams is
|
||||||
|
@ -1626,7 +1664,7 @@ type InitializeParams struct {
|
||||||
*
|
*
|
||||||
* @deprecated in favour of workspaceFolders.
|
* @deprecated in favour of workspaceFolders.
|
||||||
*/
|
*/
|
||||||
RootURI string `json:"rootUri"`
|
RootURI DocumentUri `json:"rootUri"`
|
||||||
|
|
||||||
/*Capabilities defined:
|
/*Capabilities defined:
|
||||||
* The capabilities provided by the client (editor or tool)
|
* The capabilities provided by the client (editor or tool)
|
||||||
|
@ -1861,7 +1899,7 @@ type FileEvent struct {
|
||||||
/*URI defined:
|
/*URI defined:
|
||||||
* The file's uri.
|
* The file's uri.
|
||||||
*/
|
*/
|
||||||
URI string `json:"uri"`
|
URI DocumentUri `json:"uri"`
|
||||||
|
|
||||||
/*Type defined:
|
/*Type defined:
|
||||||
* The change type.
|
* The change type.
|
||||||
|
@ -1910,10 +1948,12 @@ type PublishDiagnosticsParams struct {
|
||||||
/*URI defined:
|
/*URI defined:
|
||||||
* The URI for which diagnostic information is reported.
|
* The URI for which diagnostic information is reported.
|
||||||
*/
|
*/
|
||||||
URI string `json:"uri"`
|
URI DocumentUri `json:"uri"`
|
||||||
|
|
||||||
/*Version defined:
|
/*Version defined:
|
||||||
* Optional the version number of the document the diagnostics are published for.
|
* Optional the version number of the document the diagnostics are published for.
|
||||||
|
*
|
||||||
|
* @since 3.15
|
||||||
*/
|
*/
|
||||||
Version float64 `json:"version,omitempty"`
|
Version float64 `json:"version,omitempty"`
|
||||||
|
|
||||||
|
@ -2264,7 +2304,7 @@ type Range struct {
|
||||||
type Location struct {
|
type Location struct {
|
||||||
|
|
||||||
// URI is
|
// URI is
|
||||||
URI string `json:"uri"`
|
URI DocumentUri `json:"uri"`
|
||||||
|
|
||||||
// Range is
|
// Range is
|
||||||
Range Range `json:"range"`
|
Range Range `json:"range"`
|
||||||
|
@ -2287,7 +2327,7 @@ type LocationLink struct {
|
||||||
/*TargetURI defined:
|
/*TargetURI defined:
|
||||||
* The target resource identifier of this link.
|
* The target resource identifier of this link.
|
||||||
*/
|
*/
|
||||||
TargetURI string `json:"targetUri"`
|
TargetURI DocumentUri `json:"targetUri"`
|
||||||
|
|
||||||
/*TargetRange defined:
|
/*TargetRange defined:
|
||||||
* The full target range of this link. If the target for example is a symbol then target range is the
|
* The full target range of this link. If the target for example is a symbol then target range is the
|
||||||
|
@ -2528,7 +2568,7 @@ type CreateFile struct {
|
||||||
/*URI defined:
|
/*URI defined:
|
||||||
* The resource to create.
|
* The resource to create.
|
||||||
*/
|
*/
|
||||||
URI string `json:"uri"`
|
URI DocumentUri `json:"uri"`
|
||||||
|
|
||||||
/*Options defined:
|
/*Options defined:
|
||||||
* Additional options
|
* Additional options
|
||||||
|
@ -2565,12 +2605,12 @@ type RenameFile struct {
|
||||||
/*OldURI defined:
|
/*OldURI defined:
|
||||||
* The old (existing) location.
|
* The old (existing) location.
|
||||||
*/
|
*/
|
||||||
OldURI string `json:"oldUri"`
|
OldURI DocumentUri `json:"oldUri"`
|
||||||
|
|
||||||
/*NewURI defined:
|
/*NewURI defined:
|
||||||
* The new location.
|
* The new location.
|
||||||
*/
|
*/
|
||||||
NewURI string `json:"newUri"`
|
NewURI DocumentUri `json:"newUri"`
|
||||||
|
|
||||||
/*Options defined:
|
/*Options defined:
|
||||||
* Rename options.
|
* Rename options.
|
||||||
|
@ -2607,7 +2647,7 @@ type DeleteFile struct {
|
||||||
/*URI defined:
|
/*URI defined:
|
||||||
* The file to delete.
|
* The file to delete.
|
||||||
*/
|
*/
|
||||||
URI string `json:"uri"`
|
URI DocumentUri `json:"uri"`
|
||||||
|
|
||||||
/*Options defined:
|
/*Options defined:
|
||||||
* Delete options.
|
* Delete options.
|
||||||
|
@ -2656,7 +2696,7 @@ type TextDocumentIdentifier struct {
|
||||||
/*URI defined:
|
/*URI defined:
|
||||||
* The text document's uri.
|
* The text document's uri.
|
||||||
*/
|
*/
|
||||||
URI string `json:"uri"`
|
URI DocumentUri `json:"uri"`
|
||||||
}
|
}
|
||||||
|
|
||||||
/*VersionedTextDocumentIdentifier defined:
|
/*VersionedTextDocumentIdentifier defined:
|
||||||
|
@ -2684,7 +2724,7 @@ type TextDocumentItem struct {
|
||||||
/*URI defined:
|
/*URI defined:
|
||||||
* The text document's uri.
|
* The text document's uri.
|
||||||
*/
|
*/
|
||||||
URI string `json:"uri"`
|
URI DocumentUri `json:"uri"`
|
||||||
|
|
||||||
/*LanguageID defined:
|
/*LanguageID defined:
|
||||||
* The text document's language identifier
|
* The text document's language identifier
|
||||||
|
@ -2809,8 +2849,6 @@ type CompletionItem struct {
|
||||||
* and a completion item with an `insertText` of `console` is provided it
|
* and a completion item with an `insertText` of `console` is provided it
|
||||||
* will only insert `sole`. Therefore it is recommended to use `textEdit` instead
|
* will only insert `sole`. Therefore it is recommended to use `textEdit` instead
|
||||||
* since it avoids additional client side interpretation.
|
* since it avoids additional client side interpretation.
|
||||||
*
|
|
||||||
* @deprecated Use textEdit instead.
|
|
||||||
*/
|
*/
|
||||||
InsertText string `json:"insertText,omitempty"`
|
InsertText string `json:"insertText,omitempty"`
|
||||||
|
|
||||||
|
@ -3262,6 +3300,23 @@ type DocumentLink struct {
|
||||||
Data interface{} `json:"data,omitempty"`
|
Data interface{} `json:"data,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*SelectionRange defined:
|
||||||
|
* A selection range represents a part of a selection hierarchy. A selection range
|
||||||
|
* may have a parent selection range that contains it.
|
||||||
|
*/
|
||||||
|
type SelectionRange struct {
|
||||||
|
|
||||||
|
/*Range defined:
|
||||||
|
* The [range](#Range) of this selection range.
|
||||||
|
*/
|
||||||
|
Range Range `json:"range"`
|
||||||
|
|
||||||
|
/*Parent defined:
|
||||||
|
* The parent selection range containing this range. Therefore `parent.range` must contain `this.range`.
|
||||||
|
*/
|
||||||
|
Parent *SelectionRange `json:"parent,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
/*TextDocument defined:
|
/*TextDocument defined:
|
||||||
* A simple text document. Not to be implemented.
|
* A simple text document. Not to be implemented.
|
||||||
*/
|
*/
|
||||||
|
@ -3274,7 +3329,7 @@ type TextDocument struct {
|
||||||
*
|
*
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
URI string `json:"uri"`
|
URI DocumentUri `json:"uri"`
|
||||||
|
|
||||||
/*LanguageID defined:
|
/*LanguageID defined:
|
||||||
* The identifier of the language associated with this document.
|
* The identifier of the language associated with this document.
|
||||||
|
@ -3952,6 +4007,12 @@ type DocumentFilter struct {
|
||||||
*/
|
*/
|
||||||
type DocumentSelector []DocumentFilter
|
type DocumentSelector []DocumentFilter
|
||||||
|
|
||||||
|
// DocumentURI is a type
|
||||||
|
/**
|
||||||
|
* A tagging type for string properties that are actually URIs.
|
||||||
|
*/
|
||||||
|
type DocumentURI string
|
||||||
|
|
||||||
// DefinitionLink is a type
|
// DefinitionLink is a type
|
||||||
/**
|
/**
|
||||||
* Information about where a symbol is defined.
|
* Information about where a symbol is defined.
|
||||||
|
|
|
@ -29,6 +29,7 @@ type Server interface {
|
||||||
ColorPresentation(context.Context, *ColorPresentationParams) ([]ColorPresentation, error)
|
ColorPresentation(context.Context, *ColorPresentationParams) ([]ColorPresentation, error)
|
||||||
FoldingRange(context.Context, *FoldingRangeParams) ([]FoldingRange, error)
|
FoldingRange(context.Context, *FoldingRangeParams) ([]FoldingRange, error)
|
||||||
Declaration(context.Context, *TextDocumentPositionParams) ([]DeclarationLink, error)
|
Declaration(context.Context, *TextDocumentPositionParams) ([]DeclarationLink, error)
|
||||||
|
SelectionRange(context.Context, *SelectionRangeParams) ([]SelectionRange, error)
|
||||||
Initialize(context.Context, *InitializeParams) (*InitializeResult, error)
|
Initialize(context.Context, *InitializeParams) (*InitializeResult, error)
|
||||||
Shutdown(context.Context) error
|
Shutdown(context.Context) error
|
||||||
WillSaveWaitUntil(context.Context, *WillSaveTextDocumentParams) ([]TextEdit, error)
|
WillSaveWaitUntil(context.Context, *WillSaveTextDocumentParams) ([]TextEdit, error)
|
||||||
|
@ -227,6 +228,16 @@ func serverHandler(log xlog.Logger, server Server) jsonrpc2.Handler {
|
||||||
if err := r.Reply(ctx, resp, err); err != nil {
|
if err := r.Reply(ctx, resp, err); err != nil {
|
||||||
log.Errorf(ctx, "%v", err)
|
log.Errorf(ctx, "%v", err)
|
||||||
}
|
}
|
||||||
|
case "textDocument/selectionRange": // req
|
||||||
|
var params SelectionRangeParams
|
||||||
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
||||||
|
sendParseError(ctx, log, r, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := server.SelectionRange(ctx, ¶ms)
|
||||||
|
if err := r.Reply(ctx, resp, err); err != nil {
|
||||||
|
log.Errorf(ctx, "%v", err)
|
||||||
|
}
|
||||||
case "initialize": // req
|
case "initialize": // req
|
||||||
var params InitializeParams
|
var params InitializeParams
|
||||||
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
||||||
|
@ -564,6 +575,14 @@ func (s *serverDispatcher) Declaration(ctx context.Context, params *TextDocument
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *serverDispatcher) SelectionRange(ctx context.Context, params *SelectionRangeParams) ([]SelectionRange, error) {
|
||||||
|
var result []SelectionRange
|
||||||
|
if err := s.Conn.Call(ctx, "textDocument/selectionRange", params, &result); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *serverDispatcher) Initialize(ctx context.Context, params *InitializeParams) (*InitializeResult, error) {
|
func (s *serverDispatcher) Initialize(ctx context.Context, params *InitializeParams) (*InitializeResult, error) {
|
||||||
var result InitializeResult
|
var result InitializeResult
|
||||||
if err := s.Conn.Call(ctx, "initialize", params, &result); err != nil {
|
if err := s.Conn.Call(ctx, "initialize", params, &result); err != nil {
|
||||||
|
|
|
@ -582,7 +582,7 @@ function generate(files: string[], options: ts.CompilerOptions): void {
|
||||||
}
|
}
|
||||||
if (x[0].goType == 'bool') { // take it
|
if (x[0].goType == 'bool') { // take it
|
||||||
if (x[1].goType == 'RenameOptions') {
|
if (x[1].goType == 'RenameOptions') {
|
||||||
return ({goType: 'RenameOptions', gostuff: getText(node)})
|
return ({goType: 'interface{}', gostuff: getText(node)})
|
||||||
}
|
}
|
||||||
return ({goType: 'bool', gostuff: getText(node)})
|
return ({goType: 'bool', gostuff: getText(node)})
|
||||||
}
|
}
|
||||||
|
|
|
@ -264,6 +264,11 @@ func (s *Server) PrepareRename(context.Context, *protocol.TextDocumentPositionPa
|
||||||
func (s *Server) SetTraceNotification(context.Context, *protocol.SetTraceParams) error {
|
func (s *Server) SetTraceNotification(context.Context, *protocol.SetTraceParams) error {
|
||||||
return notImplemented("SetTraceNotification")
|
return notImplemented("SetTraceNotification")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Server) SelectionRange(context.Context, *protocol.SelectionRangeParams) ([]protocol.SelectionRange, error) {
|
||||||
|
return nil, notImplemented("SelectionRange")
|
||||||
|
}
|
||||||
|
|
||||||
func notImplemented(method string) *jsonrpc2.Error {
|
func notImplemented(method string) *jsonrpc2.Error {
|
||||||
return jsonrpc2.NewErrorf(jsonrpc2.CodeMethodNotFound, "method %q not yet implemented", method)
|
return jsonrpc2.NewErrorf(jsonrpc2.CodeMethodNotFound, "method %q not yet implemented", method)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue