mirror of https://github.com/golang/go.git
internal/lsp: update LSP stubs, including provisional InlayHints
There are also new InlineValue RPCs. Change-Id: I4ba6d4c112760a5c5a199287843c61071a7f59a2 Reviewed-on: https://go-review.googlesource.com/c/tools/+/390334 Trust: Peter Weinberger <pjw@google.com> Run-TryBot: Peter Weinberger <pjw@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Dan Kortschak <dan@kortschak.io> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
fb5dfde700
commit
85d68bc98d
|
|
@ -107,7 +107,7 @@ func (s WaitableServer) Hover(ctx context.Context, _ *protocol.HoverParams) (_ *
|
|||
return &protocol.Hover{}, nil
|
||||
}
|
||||
|
||||
func (s WaitableServer) Resolve(_ context.Context, item *protocol.CompletionItem) (*protocol.CompletionItem, error) {
|
||||
func (s WaitableServer) ResolveCompletionItem(_ context.Context, item *protocol.CompletionItem) (*protocol.CompletionItem, error) {
|
||||
return item, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Code generated (see typescript/README.md) DO NOT EDIT.
|
||||
|
||||
package protocol
|
||||
|
||||
// Package protocol contains data types and code for LSP jsonrpcs
|
||||
// Package protocol contains data types and code for LSP json rpcs
|
||||
// generated automatically from vscode-languageserver-node
|
||||
// commit: f17727af04704c0e2ede73dfdbeb463156e94561
|
||||
// last fetched Thu Feb 10 2022 14:34:11 GMT-0700 (Mountain Standard Time)
|
||||
|
||||
// Code generated (see typescript/README.md) DO NOT EDIT.
|
||||
// commit: 696f9285bf849b73745682fdb1c1feac73eb8772
|
||||
// last fetched Fri Mar 04 2022 14:48:10 GMT-0500 (Eastern Standard Time)
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -2,14 +2,14 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Code generated (see typescript/README.md) DO NOT EDIT.
|
||||
|
||||
package protocol
|
||||
|
||||
// Package protocol contains data types and code for LSP jsonrpcs
|
||||
// Package protocol contains data types and code for LSP json rpcs
|
||||
// generated automatically from vscode-languageserver-node
|
||||
// commit: f17727af04704c0e2ede73dfdbeb463156e94561
|
||||
// last fetched Thu Feb 10 2022 14:34:11 GMT-0700 (Mountain Standard Time)
|
||||
|
||||
// Code generated (see typescript/README.md) DO NOT EDIT.
|
||||
// commit: 696f9285bf849b73745682fdb1c1feac73eb8772
|
||||
// last fetched Fri Mar 04 2022 14:48:10 GMT-0500 (Eastern Standard Time)
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -36,6 +36,7 @@ type Server interface {
|
|||
DidChangeWatchedFiles(context.Context, *DidChangeWatchedFilesParams) error
|
||||
DidOpenNotebookDocument(context.Context, *DidOpenNotebookDocumentParams) error
|
||||
DidChangeNotebookDocument(context.Context, *DidChangeNotebookDocumentParams) error
|
||||
DidSaveNotebookDocument(context.Context, *DidSaveNotebookDocumentParams) error
|
||||
DidCloseNotebookDocument(context.Context, *DidCloseNotebookDocumentParams) error
|
||||
SetTrace(context.Context, *SetTraceParams) error
|
||||
LogTrace(context.Context, *LogTraceParams) error
|
||||
|
|
@ -61,13 +62,16 @@ type Server interface {
|
|||
PrepareTypeHierarchy(context.Context, *TypeHierarchyPrepareParams) ([]TypeHierarchyItem /*TypeHierarchyItem[] | null*/, error)
|
||||
Supertypes(context.Context, *TypeHierarchySupertypesParams) ([]TypeHierarchyItem /*TypeHierarchyItem[] | null*/, error)
|
||||
Subtypes(context.Context, *TypeHierarchySubtypesParams) ([]TypeHierarchyItem /*TypeHierarchyItem[] | null*/, error)
|
||||
InlineValues(context.Context, *InlineValuesParams) ([]InlineValue /*InlineValue[] | null*/, error)
|
||||
InlineValuesRefresh(context.Context) error
|
||||
InlineValue(context.Context, *InlineValueParams) ([]InlineValue /*InlineValue[] | null*/, error)
|
||||
InlineValueRefresh(context.Context) error
|
||||
InlayHint(context.Context, *InlayHintParams) ([]InlayHint /*InlayHint[] | null*/, error)
|
||||
Resolve(context.Context, *InlayHint) (*InlayHint, error)
|
||||
InlayHintRefresh(context.Context) error
|
||||
Initialize(context.Context, *ParamInitialize) (*InitializeResult, error)
|
||||
Shutdown(context.Context) error
|
||||
WillSaveWaitUntil(context.Context, *WillSaveTextDocumentParams) ([]TextEdit /*TextEdit[] | null*/, error)
|
||||
Completion(context.Context, *CompletionParams) (*CompletionList /*CompletionItem[] | CompletionList | null*/, error)
|
||||
Resolve(context.Context, *CompletionItem) (*CompletionItem, error)
|
||||
ResolveCompletionItem(context.Context, *CompletionItem) (*CompletionItem, error)
|
||||
Hover(context.Context, *HoverParams) (*Hover /*Hover | null*/, error)
|
||||
SignatureHelp(context.Context, *SignatureHelpParams) (*SignatureHelp /*SignatureHelp | null*/, error)
|
||||
Definition(context.Context, *DefinitionParams) (Definition /*Definition | DefinitionLink[] | null*/, error)
|
||||
|
|
@ -87,7 +91,7 @@ type Server interface {
|
|||
RangeFormatting(context.Context, *DocumentRangeFormattingParams) ([]TextEdit /*TextEdit[] | null*/, error)
|
||||
OnTypeFormatting(context.Context, *DocumentOnTypeFormattingParams) ([]TextEdit /*TextEdit[] | null*/, error)
|
||||
Rename(context.Context, *RenameParams) (*WorkspaceEdit /*WorkspaceEdit | null*/, error)
|
||||
PrepareRename(context.Context, *PrepareRenameParams) (*PrepareRename2Gn /*Range | { range: Range, placeholder: string } | { defaultBehavior: boolean } | null*/, error)
|
||||
PrepareRename(context.Context, *PrepareRenameParams) (*PrepareRename2Gn /*Range | { range: Range; placeholder: string } | { defaultBehavior: boolean } | null*/, error)
|
||||
ExecuteCommand(context.Context, *ExecuteCommandParams) (interface{} /* LSPAny | void | float64*/, error)
|
||||
Diagnostic(context.Context, *string) (*string, error)
|
||||
DiagnosticWorkspace(context.Context, *WorkspaceDiagnosticParams) (*WorkspaceDiagnosticReport, error)
|
||||
|
|
@ -205,6 +209,13 @@ func serverDispatch(ctx context.Context, server Server, reply jsonrpc2.Replier,
|
|||
}
|
||||
err := server.DidChangeNotebookDocument(ctx, ¶ms)
|
||||
return true, reply(ctx, nil, err)
|
||||
case "notebookDocument/didSave": // notif
|
||||
var params DidSaveNotebookDocumentParams
|
||||
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
||||
return true, sendParseError(ctx, reply, err)
|
||||
}
|
||||
err := server.DidSaveNotebookDocument(ctx, ¶ms)
|
||||
return true, reply(ctx, nil, err)
|
||||
case "notebookDocument/didClose": // notif
|
||||
var params DidCloseNotebookDocumentParams
|
||||
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
||||
|
|
@ -379,18 +390,38 @@ func serverDispatch(ctx context.Context, server Server, reply jsonrpc2.Replier,
|
|||
}
|
||||
resp, err := server.Subtypes(ctx, ¶ms)
|
||||
return true, reply(ctx, resp, err)
|
||||
case "textDocument/inlineValues": // req
|
||||
var params InlineValuesParams
|
||||
case "textDocument/inlineValue": // req
|
||||
var params InlineValueParams
|
||||
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
||||
return true, sendParseError(ctx, reply, err)
|
||||
}
|
||||
resp, err := server.InlineValues(ctx, ¶ms)
|
||||
resp, err := server.InlineValue(ctx, ¶ms)
|
||||
return true, reply(ctx, resp, err)
|
||||
case "workspace/inlineValues/refresh": // req
|
||||
case "workspace/inlineValue/refresh": // req
|
||||
if len(r.Params()) > 0 {
|
||||
return true, reply(ctx, nil, errors.Errorf("%w: expected no params", jsonrpc2.ErrInvalidParams))
|
||||
}
|
||||
err := server.InlineValuesRefresh(ctx)
|
||||
err := server.InlineValueRefresh(ctx)
|
||||
return true, reply(ctx, nil, err)
|
||||
case "textDocument/inlayHint": // req
|
||||
var params InlayHintParams
|
||||
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
||||
return true, sendParseError(ctx, reply, err)
|
||||
}
|
||||
resp, err := server.InlayHint(ctx, ¶ms)
|
||||
return true, reply(ctx, resp, err)
|
||||
case "inlayHint/resolve": // req
|
||||
var params InlayHint
|
||||
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
||||
return true, sendParseError(ctx, reply, err)
|
||||
}
|
||||
resp, err := server.Resolve(ctx, ¶ms)
|
||||
return true, reply(ctx, resp, err)
|
||||
case "workspace/inlayHint/refresh": // req
|
||||
if len(r.Params()) > 0 {
|
||||
return true, reply(ctx, nil, errors.Errorf("%w: expected no params", jsonrpc2.ErrInvalidParams))
|
||||
}
|
||||
err := server.InlayHintRefresh(ctx)
|
||||
return true, reply(ctx, nil, err)
|
||||
case "initialize": // req
|
||||
var params ParamInitialize
|
||||
|
|
@ -426,7 +457,7 @@ func serverDispatch(ctx context.Context, server Server, reply jsonrpc2.Replier,
|
|||
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
||||
return true, sendParseError(ctx, reply, err)
|
||||
}
|
||||
resp, err := server.Resolve(ctx, ¶ms)
|
||||
resp, err := server.ResolveCompletionItem(ctx, ¶ms)
|
||||
return true, reply(ctx, resp, err)
|
||||
case "textDocument/hover": // req
|
||||
var params HoverParams
|
||||
|
|
@ -664,6 +695,10 @@ func (s *serverDispatcher) DidChangeNotebookDocument(ctx context.Context, params
|
|||
return s.sender.Notify(ctx, "notebookDocument/didChange", params)
|
||||
}
|
||||
|
||||
func (s *serverDispatcher) DidSaveNotebookDocument(ctx context.Context, params *DidSaveNotebookDocumentParams) error {
|
||||
return s.sender.Notify(ctx, "notebookDocument/didSave", params)
|
||||
}
|
||||
|
||||
func (s *serverDispatcher) DidCloseNotebookDocument(ctx context.Context, params *DidCloseNotebookDocumentParams) error {
|
||||
return s.sender.Notify(ctx, "notebookDocument/didClose", params)
|
||||
}
|
||||
|
|
@ -847,16 +882,36 @@ func (s *serverDispatcher) Subtypes(ctx context.Context, params *TypeHierarchySu
|
|||
return result, nil
|
||||
}
|
||||
|
||||
func (s *serverDispatcher) InlineValues(ctx context.Context, params *InlineValuesParams) ([]InlineValue /*InlineValue[] | null*/, error) {
|
||||
func (s *serverDispatcher) InlineValue(ctx context.Context, params *InlineValueParams) ([]InlineValue /*InlineValue[] | null*/, error) {
|
||||
var result []InlineValue /*InlineValue[] | null*/
|
||||
if err := s.sender.Call(ctx, "textDocument/inlineValues", params, &result); err != nil {
|
||||
if err := s.sender.Call(ctx, "textDocument/inlineValue", params, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (s *serverDispatcher) InlineValuesRefresh(ctx context.Context) error {
|
||||
return s.sender.Call(ctx, "workspace/inlineValues/refresh", nil, nil)
|
||||
func (s *serverDispatcher) InlineValueRefresh(ctx context.Context) error {
|
||||
return s.sender.Call(ctx, "workspace/inlineValue/refresh", nil, nil)
|
||||
}
|
||||
|
||||
func (s *serverDispatcher) InlayHint(ctx context.Context, params *InlayHintParams) ([]InlayHint /*InlayHint[] | null*/, error) {
|
||||
var result []InlayHint /*InlayHint[] | null*/
|
||||
if err := s.sender.Call(ctx, "textDocument/inlayHint", params, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (s *serverDispatcher) Resolve(ctx context.Context, params *InlayHint) (*InlayHint, error) {
|
||||
var result *InlayHint
|
||||
if err := s.sender.Call(ctx, "inlayHint/resolve", params, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (s *serverDispatcher) InlayHintRefresh(ctx context.Context) error {
|
||||
return s.sender.Call(ctx, "workspace/inlayHint/refresh", nil, nil)
|
||||
}
|
||||
|
||||
func (s *serverDispatcher) Initialize(ctx context.Context, params *ParamInitialize) (*InitializeResult, error) {
|
||||
|
|
@ -887,7 +942,7 @@ func (s *serverDispatcher) Completion(ctx context.Context, params *CompletionPar
|
|||
return result, nil
|
||||
}
|
||||
|
||||
func (s *serverDispatcher) Resolve(ctx context.Context, params *CompletionItem) (*CompletionItem, error) {
|
||||
func (s *serverDispatcher) ResolveCompletionItem(ctx context.Context, params *CompletionItem) (*CompletionItem, error) {
|
||||
var result *CompletionItem
|
||||
if err := s.sender.Call(ctx, "completionItem/resolve", params, &result); err != nil {
|
||||
return nil, err
|
||||
|
|
@ -1043,8 +1098,8 @@ func (s *serverDispatcher) Rename(ctx context.Context, params *RenameParams) (*W
|
|||
return result, nil
|
||||
}
|
||||
|
||||
func (s *serverDispatcher) PrepareRename(ctx context.Context, params *PrepareRenameParams) (*PrepareRename2Gn /*Range | { range: Range, placeholder: string } | { defaultBehavior: boolean } | null*/, error) {
|
||||
var result *PrepareRename2Gn /*Range | { range: Range, placeholder: string } | { defaultBehavior: boolean } | null*/
|
||||
func (s *serverDispatcher) PrepareRename(ctx context.Context, params *PrepareRenameParams) (*PrepareRename2Gn /*Range | { range: Range; placeholder: string } | { defaultBehavior: boolean } | null*/, error) {
|
||||
var result *PrepareRename2Gn /*Range | { range: Range; placeholder: string } | { defaultBehavior: boolean } | null*/
|
||||
if err := s.sender.Call(ctx, "textDocument/prepareRename", params, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -596,12 +596,17 @@ function addToProperties(pm: propMap, tn: ts.TypeNode | undefined, prefix = '')
|
|||
addToProperties(pm, ps.type, name);
|
||||
});
|
||||
} else if (strKind(tn) === 'TypeLiteral') {
|
||||
if (!ts.isTypeLiteralNode(tn)) new Error(`598 ${strKind(tn)}`);
|
||||
if (!ts.isTypeLiteralNode(tn)) new Error(`599 ${strKind(tn)}`);
|
||||
tn.forEachChild((child: ts.Node) => {
|
||||
if (!ts.isPropertySignature(child)) throw new Error(`600 ${strKind(child)}`);
|
||||
const name = `${prefix}.${child.name.getText()}`;
|
||||
propMapSet(pm, name, child);
|
||||
addToProperties(pm, child.type, name);
|
||||
if (ts.isPropertySignature(child)) {
|
||||
const name = `${prefix}.${child.name.getText()}`;
|
||||
propMapSet(pm, name, child);
|
||||
addToProperties(pm, child.type, name);
|
||||
} else if (!ts.isIndexSignatureDeclaration(child)) {
|
||||
// ignoring IndexSignatures, seen as relatedDocument in
|
||||
// RelatedFullDocumentDiagnosticReport
|
||||
throw new Error(`608 ${strKind(child)} ${loc(child)}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export const fnames = [
|
|||
`${dir}/${srcDir}/protocol/src/browser/main.ts`, `${dir}${srcDir}/types/src/main.ts`,
|
||||
`${dir}${srcDir}/jsonrpc/src/node/main.ts`
|
||||
];
|
||||
export const gitHash = 'f17727af04704c0e2ede73dfdbeb463156e94561';
|
||||
export const gitHash = '696f9285bf849b73745682fdb1c1feac73eb8772';
|
||||
let outFname = 'tsprotocol.go';
|
||||
let fda: number, fdb: number, fde: number; // file descriptors
|
||||
|
||||
|
|
@ -72,17 +72,17 @@ export function computeHeader(pkgDoc: boolean): string {
|
|||
|
||||
`;
|
||||
const a =
|
||||
'// Package protocol contains data types and code for LSP jsonrpcs\n' +
|
||||
'// Package protocol contains data types and code for LSP json rpcs\n' +
|
||||
'// generated automatically from vscode-languageserver-node\n' +
|
||||
`// commit: ${gitHash}\n` +
|
||||
`// last fetched ${lastDate}\n`;
|
||||
const b = 'package protocol\n';
|
||||
const c = '\n// Code generated (see typescript/README.md) DO NOT EDIT.\n\n';
|
||||
if (pkgDoc) {
|
||||
return cp + a + b + c;
|
||||
return cp + c + a + b;
|
||||
}
|
||||
else {
|
||||
return cp + b + a + c;
|
||||
return cp + c+ b + a;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -104,6 +104,10 @@ func (s *Server) DidSave(ctx context.Context, params *protocol.DidSaveTextDocume
|
|||
return s.didSave(ctx, params)
|
||||
}
|
||||
|
||||
func (s *Server) DidSaveNotebookDocument(context.Context, *protocol.DidSaveNotebookDocumentParams) error {
|
||||
return notImplemented("DidSaveNotebookDocument")
|
||||
}
|
||||
|
||||
func (s *Server) DocumentColor(context.Context, *protocol.DocumentColorParams) ([]protocol.ColorInformation, error) {
|
||||
return nil, notImplemented("DocumentColor")
|
||||
}
|
||||
|
|
@ -156,12 +160,20 @@ func (s *Server) Initialized(ctx context.Context, params *protocol.InitializedPa
|
|||
return s.initialized(ctx, params)
|
||||
}
|
||||
|
||||
func (s *Server) InlineValues(context.Context, *protocol.InlineValuesParams) ([]protocol.InlineValue, error) {
|
||||
return nil, notImplemented("InlineValues")
|
||||
func (s *Server) InlayHint(context.Context, *protocol.InlayHintParams) ([]protocol.InlayHint, error) {
|
||||
return nil, notImplemented("InlayHint")
|
||||
}
|
||||
|
||||
func (s *Server) InlineValuesRefresh(context.Context) error {
|
||||
return notImplemented("InlineValuesRefresh")
|
||||
func (s *Server) InlayHintRefresh(context.Context) error {
|
||||
return notImplemented("InlayHintRefresh")
|
||||
}
|
||||
|
||||
func (s *Server) InlineValue(context.Context, *protocol.InlineValueParams) ([]protocol.InlineValue, error) {
|
||||
return nil, notImplemented("InlineValue")
|
||||
}
|
||||
|
||||
func (s *Server) InlineValueRefresh(context.Context) error {
|
||||
return notImplemented("InlineValueRefresh")
|
||||
}
|
||||
|
||||
func (s *Server) LinkedEditingRange(context.Context, *protocol.LinkedEditingRangeParams) (*protocol.LinkedEditingRanges, error) {
|
||||
|
|
@ -212,7 +224,7 @@ func (s *Server) Rename(ctx context.Context, params *protocol.RenameParams) (*pr
|
|||
return s.rename(ctx, params)
|
||||
}
|
||||
|
||||
func (s *Server) Resolve(context.Context, *protocol.CompletionItem) (*protocol.CompletionItem, error) {
|
||||
func (s *Server) Resolve(context.Context, *protocol.InlayHint) (*protocol.InlayHint, error) {
|
||||
return nil, notImplemented("Resolve")
|
||||
}
|
||||
|
||||
|
|
@ -224,6 +236,10 @@ func (s *Server) ResolveCodeLens(context.Context, *protocol.CodeLens) (*protocol
|
|||
return nil, notImplemented("ResolveCodeLens")
|
||||
}
|
||||
|
||||
func (s *Server) ResolveCompletionItem(context.Context, *protocol.CompletionItem) (*protocol.CompletionItem, error) {
|
||||
return nil, notImplemented("ResolveCompletionItem")
|
||||
}
|
||||
|
||||
func (s *Server) ResolveDocumentLink(context.Context, *protocol.DocumentLink) (*protocol.DocumentLink, error) {
|
||||
return nil, notImplemented("ResolveDocumentLink")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue