internal/lsp: bring the LSP stubs up to date

There are no changes to the internals of gopls. THe newest version
of the LSP has support for notebooks.

Change-Id: I6d12350e195f459df14efe3b349fff4cc917470c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/379114
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Peter Weinberger <pjw@google.com>
Trust: Peter Weinberger <pjw@google.com>
This commit is contained in:
pjw 2022-01-17 13:45:21 -05:00 committed by Peter Weinberger
parent fddb0d54e9
commit a8c745991d
6 changed files with 287 additions and 30 deletions

View File

@ -6,8 +6,8 @@ package protocol
// Package protocol contains data types and code for LSP jsonrpcs
// generated automatically from vscode-languageserver-node
// commit: d959faf4be476a6e0a08d5612e91fcac14ff9929
// last fetched Mon Nov 29 2021 15:51:05 GMT-0500 (Eastern Standard Time)
// commit: f17727af04704c0e2ede73dfdbeb463156e94561
// last fetched Mon Jan 17 2022 11:52:52 GMT-0500 (Eastern Standard Time)
// Code generated (see typescript/README.md) DO NOT EDIT.

View File

@ -4,8 +4,8 @@
// Package protocol contains data types and code for LSP jsonrpcs
// generated automatically from vscode-languageserver-node
// commit: d959faf4be476a6e0a08d5612e91fcac14ff9929
// last fetched Wed Dec 01 2021 09:27:34 GMT-0500 (Eastern Standard Time)
// commit: f17727af04704c0e2ede73dfdbeb463156e94561
// last fetched Mon Jan 17 2022 11:52:52 GMT-0500 (Eastern Standard Time)
package protocol
// Code generated (see typescript/README.md) DO NOT EDIT.
@ -1478,6 +1478,30 @@ type DidChangeConfigurationParams struct {
Settings LSPAny `json:"settings"`
}
type DidChangeNotebookDocumentParams struct {
/**
* The notebook document that did change. The version number points
* to the version after all provided changes have been applied.
*/
NotebookDocument VersionedNotebookDocumentIdentifier `json:"notebookDocument"`
/**
* The actual changes to the notebook document.
*
* The changes describe single state changes to the notebook document.
* So if there are two changes c1 (at array index 0) and c2 (at array
* index 1) for a notebook in state S then c1 moves the notebook from
* S to S' and c2 from S' to S''. So c1 is computed on the state S and
* c2 is computed on the state S'.
*
* To mirror the content of a notebook using change events use the following approach:
* - start with the same initial content
* - apply the 'notebookDocument/didChange' notifications in the order you receive them.
* - apply the `NotebookChangeEvent`s in a single notification in the order
* you receive them.
*/
Changes []NotebookDocumentChangeEvent `json:"changes"`
}
/**
* The change text document notification's parameters.
*/
@ -1543,6 +1567,18 @@ type DidChangeWorkspaceFoldersParams struct {
Event WorkspaceFoldersChangeEvent `json:"event"`
}
/**
* The params sent in a close notebook document notification.
*
* @since 3.17.0 - proposed state
*/
type DidCloseNotebookDocumentParams struct {
/**
* The notebook document that got opened.
*/
NotebookDocument NotebookDocumentIdentifier `json:"notebookDocument"`
}
/**
* The parameters send in a close text document notification
*/
@ -1553,6 +1589,18 @@ type DidCloseTextDocumentParams struct {
TextDocument TextDocumentIdentifier `json:"textDocument"`
}
/**
* The params sent in a open notebook document notification.
*
* @since 3.17.0 - proposed state
*/
type DidOpenNotebookDocumentParams struct {
/**
* The notebook document that got opened.
*/
NotebookDocument NotebookDocument `json:"notebookDocument"`
}
/**
* The parameters send in a open text document notification
*/
@ -1643,29 +1691,12 @@ type DocumentDiagnosticParams struct {
type DocumentDiagnosticReport = interface{} /*RelatedFullDocumentDiagnosticReport | RelatedUnchangedDocumentDiagnosticReport*/
/**
* A document filter denotes a document by different properties like
* the [language](#TextDocument.languageId), the [scheme](#Uri.scheme) of
* its resource, or a glob-pattern that is applied to the [path](#TextDocument.fileName).
* A document filter describes a top level text document or
* a notebook cell document.
*
* Glob patterns can have the following syntax:
* - `*` to match one or more characters in a path segment
* - `?` to match on one character in a path segment
* - `**` to match any number of path segments, including none
* - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files)
* - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, )
* - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)
*
* @sample A language filter that applies to typescript files on disk: `{ language: 'typescript', scheme: 'file' }`
* @sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**package.json' }`
* @since 3.17.0 - proposed support for NotebookCellTextDocumentFilter.
*/
type DocumentFilter = struct {
/** A language id, like `typescript`. */
Language string `json:"language"`
/** A Uri [scheme](#Uri.scheme), like `file` or `untitled`. */
Scheme string `json:"scheme,omitempty"`
/** A glob pattern, like `*.{ts,js}`. */
Pattern string `json:"pattern,omitempty"`
}
type DocumentFilter = interface{} /*TextDocumentFilter | NotebookCellTextDocumentFilter*/
/**
* Client capabilities of a [DocumentFormattingRequest](#DocumentFormattingRequest).
@ -3113,6 +3144,131 @@ type MonikerRegistrationOptions struct {
MonikerOptions
}
/**
* A notebook cell.
*
* @since 3.17.0 - proposed state
*/
type NotebookCell struct {
/**
* The cell's kind
*/
Kind NotebookCellKind `json:"kind"`
/**
* The cell's text represented as a text document.
* The document's content is synced using the
* existing text document sync notifications.
*/
Document DocumentURI `json:"document"`
}
/**
* A change describing how to move a `NotebookCell`
* array from state S' to S''.
*
* @since 3.17.0 - proposed state
*/
type NotebookCellChange struct {
/**
* The start oftest of the cell that changed.
*/
Start uint32 `json:"start"`
/**
* The deleted cells
*/
DeleteCount uint32 `json:"deleteCount"`
/**
* The new cells, if any
*/
Cells []NotebookCell `json:"cells,omitempty"`
}
/**
* A notebook cell kind.
*
* @since 3.17.0 - proposed state
*/
type NotebookCellKind float64
/**
* A notebook cell text document filter denotes a cell text
* document by different properties.
*
* @since 3.17.0 - proposed state.
*/
type NotebookCellTextDocumentFilter = struct {
/**
* A filter that matches against the notebook
* containing the notebook cell.
*/
NotebookDocument NotebookDocumentFilter `json:"notebookDocument"`
/**
* A language id like `python`.
*
* Will be matched against the language id of the
* notebook cell document.
*/
CellLanguage string `json:"cellLanguage,omitempty"`
}
/**
* A notebook document.
*
* @since 3.17.0 - proposed state
*/
type NotebookDocument struct {
/**
* The notebook document's uri.
*/
URI URI `json:"uri"`
/**
* The type of the notebook.
*/
NotebookType string `json:"notebookType"`
/**
* The version number of this document (it will increase after each
* change, including undo/redo).
*/
Version int32 `json:"version"`
/**
* The cells of a notebook.
*/
Cells []NotebookCell `json:"cells"`
}
type NotebookDocumentChangeEvent struct {
Cells NotebookCellChange `json:"cells"`
}
/**
* A notebook document filter denotes a notebook document by
* different properties.
*
* @since 3.17.0 - proposed state.
*/
type NotebookDocumentFilter = struct {
/** The type of the enclosing notebook. */
NotebookType string `json:"notebookType"`
/** A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
* Will be matched against the URI of the notebook. */
Scheme string `json:"scheme,omitempty"`
/** A glob pattern, like `*.ipynb`.
* Will be matched against the notebooks` URI path section.*/
Pattern string `json:"pattern,omitempty"`
}
/**
* A literal to identify a notebook document in the client.
*
* @since 3.17.0 - proposed state
*/
type NotebookDocumentIdentifier struct {
/**
* The notebook document's uri.
*/
URI URI `json:"uri"`
}
/**
* A text document identifier to optionally denote a specific version of a text document.
*/
@ -3982,7 +4138,7 @@ type ServerCapabilities struct {
*
* @since 3.17.0 - proposed state
*/
InlineValuesProvider interface{}/* bool | InlineValuesOptions | InlineValuesOptions | InlineValuesRegistrationOptions*/ `json:"inlineValuesProvider,omitempty"`
InlineValuesProvider interface{}/* bool | InlineValuesOptions | InlineValuesRegistrationOptions*/ `json:"inlineValuesProvider,omitempty"`
/**
* Experimental server capabilities.
*/
@ -4533,6 +4689,33 @@ type TextDocumentEdit struct {
Edits []TextEdit/*TextEdit | AnnotatedTextEdit*/ `json:"edits"`
}
/**
* A document filter denotes a document by different properties like
* the [language](#TextDocument.languageId), the [scheme](#Uri.scheme) of
* its resource, or a glob-pattern that is applied to the [path](#TextDocument.fileName).
*
* Glob patterns can have the following syntax:
* - `*` to match one or more characters in a path segment
* - `?` to match on one character in a path segment
* - `**` to match any number of path segments, including none
* - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files)
* - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, )
* - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)
*
* @sample A language filter that applies to typescript files on disk: `{ language: 'typescript', scheme: 'file' }`
* @sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**package.json' }`
*
* @since 3.17.0 - proposed state.
*/
type TextDocumentFilter = struct {
/** A language id, like `typescript`. */
Language string `json:"language"`
/** A Uri [scheme](#Uri.scheme), like `file` or `untitled`. */
Scheme string `json:"scheme,omitempty"`
/** A glob pattern, like `*.{ts,js}`. */
Pattern string `json:"pattern,omitempty"`
}
/**
* A literal to identify a text document in the client.
*/
@ -4869,6 +5052,22 @@ type UnregistrationParams struct {
Unregisterations []Unregistration `json:"unregisterations"`
}
/**
* A versioned notebook document identifier.
*
* @since 3.17.0 - proposed state
*/
type VersionedNotebookDocumentIdentifier struct {
/**
* The version number of this notebook document.
*/
Version int32 `json:"version"`
/**
* The notebook document's uri.
*/
URI URI `json:"uri"`
}
/**
* A text document identifier to denote a specific version of a text document.
*/
@ -5718,6 +5917,16 @@ const (
* variable of a function, a class not visible outside the project, ...)
*/
Local MonikerKind = "local"
/**
* A markup-cell is formatted source that is used for display.
*/
Markup NotebookCellKind = 1
/**
* A code-cell is source code.
*/
Code NotebookCellKind = 2
/**
* Supports creating new files and folders.
*/

View File

@ -6,8 +6,8 @@ package protocol
// Package protocol contains data types and code for LSP jsonrpcs
// generated automatically from vscode-languageserver-node
// commit: d959faf4be476a6e0a08d5612e91fcac14ff9929
// last fetched Mon Nov 29 2021 15:51:05 GMT-0500 (Eastern Standard Time)
// commit: f17727af04704c0e2ede73dfdbeb463156e94561
// last fetched Mon Jan 17 2022 11:52:52 GMT-0500 (Eastern Standard Time)
// Code generated (see typescript/README.md) DO NOT EDIT.
@ -34,6 +34,9 @@ type Server interface {
DidSave(context.Context, *DidSaveTextDocumentParams) error
WillSave(context.Context, *WillSaveTextDocumentParams) error
DidChangeWatchedFiles(context.Context, *DidChangeWatchedFilesParams) error
DidOpenNotebookDocument(context.Context, *DidOpenNotebookDocumentParams) error
DidChangeNotebookDocument(context.Context, *DidChangeNotebookDocumentParams) error
DidCloseNotebookDocument(context.Context, *DidCloseNotebookDocumentParams) error
SetTrace(context.Context, *SetTraceParams) error
LogTrace(context.Context, *LogTraceParams) error
Implementation(context.Context, *ImplementationParams) (Definition /*Definition | DefinitionLink[] | null*/, error)
@ -188,6 +191,27 @@ func serverDispatch(ctx context.Context, server Server, reply jsonrpc2.Replier,
}
err := server.DidChangeWatchedFiles(ctx, &params)
return true, reply(ctx, nil, err)
case "notebookDocument/didOpen": // notif
var params DidOpenNotebookDocumentParams
if err := json.Unmarshal(r.Params(), &params); err != nil {
return true, sendParseError(ctx, reply, err)
}
err := server.DidOpenNotebookDocument(ctx, &params)
return true, reply(ctx, nil, err)
case "notebookDocument/didChange": // notif
var params DidChangeNotebookDocumentParams
if err := json.Unmarshal(r.Params(), &params); err != nil {
return true, sendParseError(ctx, reply, err)
}
err := server.DidChangeNotebookDocument(ctx, &params)
return true, reply(ctx, nil, err)
case "notebookDocument/didClose": // notif
var params DidCloseNotebookDocumentParams
if err := json.Unmarshal(r.Params(), &params); err != nil {
return true, sendParseError(ctx, reply, err)
}
err := server.DidCloseNotebookDocument(ctx, &params)
return true, reply(ctx, nil, err)
case "$/setTrace": // notif
var params SetTraceParams
if err := json.Unmarshal(r.Params(), &params); err != nil {
@ -632,6 +656,18 @@ func (s *serverDispatcher) DidChangeWatchedFiles(ctx context.Context, params *Di
return s.sender.Notify(ctx, "workspace/didChangeWatchedFiles", params)
}
func (s *serverDispatcher) DidOpenNotebookDocument(ctx context.Context, params *DidOpenNotebookDocumentParams) error {
return s.sender.Notify(ctx, "notebookDocument/didOpen", params)
}
func (s *serverDispatcher) DidChangeNotebookDocument(ctx context.Context, params *DidChangeNotebookDocumentParams) error {
return s.sender.Notify(ctx, "notebookDocument/didChange", params)
}
func (s *serverDispatcher) DidCloseNotebookDocument(ctx context.Context, params *DidCloseNotebookDocumentParams) error {
return s.sender.Notify(ctx, "notebookDocument/didClose", params)
}
func (s *serverDispatcher) SetTrace(ctx context.Context, params *SetTraceParams) error {
return s.sender.Notify(ctx, "$/setTrace", params)
}

View File

@ -919,7 +919,7 @@ function goUnionType(n: ts.UnionTypeNode, nm: string): string {
const bb = strKind(n.types[1]);
const cc = strKind(n.types[2]);
if (nm === 'workspace/symbol') return `${goType(n.types[0], '930')} ${help}`;
if (nm == 'DocumentFilter') {
if (nm == 'DocumentFilter' || nm == 'NotebookDocumentFilter' || nm == 'TextDocumentFilter') {
// not really a union. the first is enough, up to a missing
// omitempty but avoid repetitious comments
return `${goType(n.types[0], 'g')}`;

View File

@ -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 = 'd959faf4be476a6e0a08d5612e91fcac14ff9929';
export const gitHash = 'f17727af04704c0e2ede73dfdbeb463156e94561';
let outFname = 'tsprotocol.go';
let fda: number, fdb: number, fde: number; // file descriptors

View File

@ -60,6 +60,10 @@ func (s *Server) DidChangeConfiguration(ctx context.Context, _gen *protocol.DidC
return s.didChangeConfiguration(ctx, _gen)
}
func (s *Server) DidChangeNotebookDocument(context.Context, *protocol.DidChangeNotebookDocumentParams) error {
return notImplemented("DidChangeNotebookDocument")
}
func (s *Server) DidChangeWatchedFiles(ctx context.Context, params *protocol.DidChangeWatchedFilesParams) error {
return s.didChangeWatchedFiles(ctx, params)
}
@ -72,6 +76,10 @@ func (s *Server) DidClose(ctx context.Context, params *protocol.DidCloseTextDocu
return s.didClose(ctx, params)
}
func (s *Server) DidCloseNotebookDocument(context.Context, *protocol.DidCloseNotebookDocumentParams) error {
return notImplemented("DidCloseNotebookDocument")
}
func (s *Server) DidCreateFiles(context.Context, *protocol.CreateFilesParams) error {
return notImplemented("DidCreateFiles")
}
@ -84,6 +92,10 @@ func (s *Server) DidOpen(ctx context.Context, params *protocol.DidOpenTextDocume
return s.didOpen(ctx, params)
}
func (s *Server) DidOpenNotebookDocument(context.Context, *protocol.DidOpenNotebookDocumentParams) error {
return notImplemented("DidOpenNotebookDocument")
}
func (s *Server) DidRenameFiles(context.Context, *protocol.RenameFilesParams) error {
return notImplemented("DidRenameFiles")
}