diff --git a/internal/lsp/completion.go b/internal/lsp/completion.go index 8b7f8a32a1..52a8c76d3a 100644 --- a/internal/lsp/completion.go +++ b/internal/lsp/completion.go @@ -15,7 +15,7 @@ import ( ) func toProtocolCompletionItems(candidates []source.CompletionItem, prefix string, pos protocol.Position, snippetsSupported, signatureHelpEnabled bool) []protocol.CompletionItem { - insertTextFormat := protocol.PlainTextFormat + insertTextFormat := protocol.PlainTextTextFormat if snippetsSupported { insertTextFormat = protocol.SnippetTextFormat } @@ -35,8 +35,8 @@ func toProtocolCompletionItems(candidates []source.CompletionItem, prefix string item := protocol.CompletionItem{ Label: candidate.Label, Detail: candidate.Detail, - Kind: float64(toProtocolCompletionItemKind(candidate.Kind)), - InsertTextFormat: insertTextFormat, + Kind: toProtocolCompletionItemKind(candidate.Kind), + InsertTextFormat: protocol.PlainTextTextFormat, TextEdit: &protocol.TextEdit{ NewText: insertText, Range: protocol.Range{ @@ -105,7 +105,7 @@ func labelToProtocolSnippets(label string, kind source.CompletionItemKind, inser return label, true } // Don't add parameters or parens for the plaintext insert format. - if insertTextFormat == protocol.PlainTextFormat { + if insertTextFormat == protocol.PlainTextTextFormat { return trimmed, true } // If we do have signature help enabled, the user can see parameters as diff --git a/internal/lsp/diagnostics.go b/internal/lsp/diagnostics.go index 9f07c8946a..558b876640 100644 --- a/internal/lsp/diagnostics.go +++ b/internal/lsp/diagnostics.go @@ -12,7 +12,7 @@ import ( "golang.org/x/tools/internal/lsp/source" ) -func (s *server) cacheAndDiagnose(ctx context.Context, uri protocol.DocumentURI, content string) { +func (s *server) cacheAndDiagnose(ctx context.Context, uri string, content string) { sourceURI, err := fromProtocolURI(uri) if err != nil { return // handle error? @@ -31,7 +31,7 @@ func (s *server) cacheAndDiagnose(ctx context.Context, uri protocol.DocumentURI, } for filename, diagnostics := range reports { s.client.PublishDiagnostics(ctx, &protocol.PublishDiagnosticsParams{ - URI: protocol.DocumentURI(source.ToURI(filename)), + URI: string(source.ToURI(filename)), Diagnostics: toProtocolDiagnostics(ctx, s.view, diagnostics), }) } diff --git a/internal/lsp/format.go b/internal/lsp/format.go index 58369fb39e..0642ce3931 100644 --- a/internal/lsp/format.go +++ b/internal/lsp/format.go @@ -8,7 +8,7 @@ import ( ) // formatRange formats a document with a given range. -func formatRange(ctx context.Context, v source.View, uri protocol.DocumentURI, rng *protocol.Range) ([]protocol.TextEdit, error) { +func formatRange(ctx context.Context, v source.View, uri string, rng *protocol.Range) ([]protocol.TextEdit, error) { sourceURI, err := fromProtocolURI(uri) if err != nil { return nil, err diff --git a/internal/lsp/imports.go b/internal/lsp/imports.go index a914d5a3ff..ca712f2d2a 100644 --- a/internal/lsp/imports.go +++ b/internal/lsp/imports.go @@ -11,7 +11,7 @@ import ( "golang.org/x/tools/internal/lsp/source" ) -func organizeImports(ctx context.Context, v source.View, uri protocol.DocumentURI) ([]protocol.TextEdit, error) { +func organizeImports(ctx context.Context, v source.View, uri string) ([]protocol.TextEdit, error) { sourceURI, err := fromProtocolURI(uri) if err != nil { return nil, err diff --git a/internal/lsp/lsp_test.go b/internal/lsp/lsp_test.go index edde8484ef..79bd6a9b06 100644 --- a/internal/lsp/lsp_test.go +++ b/internal/lsp/lsp_test.go @@ -248,7 +248,7 @@ func (c completions) test(t *testing.T, exported *packagestest.Exported, s *serv list, err := s.Completion(context.Background(), &protocol.CompletionParams{ TextDocumentPositionParams: protocol.TextDocumentPositionParams{ TextDocument: protocol.TextDocumentIdentifier{ - URI: protocol.DocumentURI(source.ToURI(src.Filename)), + URI: string(source.ToURI(src.Filename)), }, Position: protocol.Position{ Line: float64(src.Line - 1), @@ -278,7 +278,7 @@ func (c completions) test(t *testing.T, exported *packagestest.Exported, s *serv func isBuiltin(item protocol.CompletionItem) bool { // If a type has no detail, it is a builtin type. - if item.Detail == "" && item.Kind == float64(protocol.TypeParameterCompletion) { + if item.Detail == "" && item.Kind == protocol.TypeParameterCompletion { return true } // Remaining builtin constants, variables, interfaces, and functions. @@ -324,7 +324,7 @@ func (i completionItems) collect(pos token.Pos, label, detail, kind string) { i[pos] = &protocol.CompletionItem{ Label: label, Detail: detail, - Kind: float64(k), + Kind: k, } } @@ -364,7 +364,7 @@ func (f formats) test(t *testing.T, s *server) { for filename, gofmted := range f { edits, err := s.Formatting(context.Background(), &protocol.DocumentFormattingParams{ TextDocument: protocol.TextDocumentIdentifier{ - URI: protocol.DocumentURI(source.ToURI(filename)), + URI: string(source.ToURI(filename)), }, }) if err != nil { diff --git a/internal/lsp/position.go b/internal/lsp/position.go index c154105ca8..087ddbcb3b 100644 --- a/internal/lsp/position.go +++ b/internal/lsp/position.go @@ -14,9 +14,9 @@ import ( "golang.org/x/tools/internal/lsp/source" ) -// fromProtocolURI converts a protocol.DocumentURI to a source.URI. +// fromProtocolURI converts a string to a source.URI. // TODO(rstambler): Add logic here to support Windows. -func fromProtocolURI(uri protocol.DocumentURI) (source.URI, error) { +func fromProtocolURI(uri string) (source.URI, error) { unescaped, err := url.PathUnescape(string(uri)) if err != nil { return "", err @@ -45,7 +45,7 @@ func toProtocolLocation(fset *token.FileSet, r source.Range) protocol.Location { tok := fset.File(r.Start) uri := source.ToURI(tok.Name()) return protocol.Location{ - URI: protocol.DocumentURI(uri), + URI: string(uri), Range: toProtocolRange(tok, r), } } diff --git a/internal/lsp/protocol/preserve/README b/internal/lsp/protocol/preserve/README new file mode 100644 index 0000000000..d1b04a2eb5 --- /dev/null +++ b/internal/lsp/protocol/preserve/README @@ -0,0 +1 @@ +These are the hand-generated protocol files, for reference while debugging. diff --git a/internal/lsp/protocol/basic.go b/internal/lsp/protocol/preserve/basic.go similarity index 100% rename from internal/lsp/protocol/basic.go rename to internal/lsp/protocol/preserve/basic.go diff --git a/internal/lsp/protocol/diagnostics.go b/internal/lsp/protocol/preserve/diagnostics.go similarity index 100% rename from internal/lsp/protocol/diagnostics.go rename to internal/lsp/protocol/preserve/diagnostics.go diff --git a/internal/lsp/protocol/general.go b/internal/lsp/protocol/preserve/general.go similarity index 100% rename from internal/lsp/protocol/general.go rename to internal/lsp/protocol/preserve/general.go diff --git a/internal/lsp/protocol/language.go b/internal/lsp/protocol/preserve/language.go similarity index 100% rename from internal/lsp/protocol/language.go rename to internal/lsp/protocol/preserve/language.go diff --git a/internal/lsp/protocol/registration.go b/internal/lsp/protocol/preserve/registration.go similarity index 100% rename from internal/lsp/protocol/registration.go rename to internal/lsp/protocol/preserve/registration.go diff --git a/internal/lsp/protocol/text.go b/internal/lsp/protocol/preserve/text.go similarity index 100% rename from internal/lsp/protocol/text.go rename to internal/lsp/protocol/preserve/text.go diff --git a/internal/lsp/protocol/window.go b/internal/lsp/protocol/preserve/window.go similarity index 100% rename from internal/lsp/protocol/window.go rename to internal/lsp/protocol/preserve/window.go diff --git a/internal/lsp/protocol/workspace.go b/internal/lsp/protocol/preserve/workspace.go similarity index 100% rename from internal/lsp/protocol/workspace.go rename to internal/lsp/protocol/preserve/workspace.go diff --git a/internal/lsp/protocol/server.go b/internal/lsp/protocol/server.go index 1f1a0b7654..5e8e28d5a0 100644 --- a/internal/lsp/protocol/server.go +++ b/internal/lsp/protocol/server.go @@ -48,7 +48,7 @@ type Server interface { RangeFormatting(context.Context, *DocumentRangeFormattingParams) ([]TextEdit, error) OnTypeFormatting(context.Context, *DocumentOnTypeFormattingParams) ([]TextEdit, error) Rename(context.Context, *RenameParams) ([]WorkspaceEdit, error) - FoldingRanges(context.Context, *FoldingRangeRequestParam) ([]FoldingRange, error) + FoldingRanges(context.Context, *FoldingRangeParams) ([]FoldingRange, error) } func serverHandler(server Server) jsonrpc2.Handler { @@ -374,7 +374,7 @@ func serverHandler(server Server) jsonrpc2.Handler { unhandledError(conn.Reply(ctx, r, resp, err)) case "textDocument/foldingRange": - var params FoldingRangeRequestParam + var params FoldingRangeParams if err := json.Unmarshal(*r.Params, ¶ms); err != nil { sendParseError(ctx, conn, r, err) return @@ -637,10 +637,17 @@ func (s *serverDispatcher) Rename(ctx context.Context, params *RenameParams) ([] return result, nil } -func (s *serverDispatcher) FoldingRanges(ctx context.Context, params *FoldingRangeRequestParam) ([]FoldingRange, error) { +func (s *serverDispatcher) FoldingRanges(ctx context.Context, params *FoldingRangeParams) ([]FoldingRange, error) { var result []FoldingRange if err := s.Conn.Call(ctx, "textDocument/foldingRanges", params, &result); err != nil { return nil, err } return result, nil } + +type CancelParams struct { + /** + * The request id to cancel. + */ + ID jsonrpc2.ID `json:"id"` +} diff --git a/internal/lsp/protocol/tsprotocol.go b/internal/lsp/protocol/tsprotocol.go new file mode 100644 index 0000000000..c0cba77f3c --- /dev/null +++ b/internal/lsp/protocol/tsprotocol.go @@ -0,0 +1,3796 @@ +// Package protocol contains data types for LSP jsonrpcs +// generated automatically from vscode-languageserver-node +// version of Mon Feb 25 2019 09:01:22 GMT-0500 (Eastern Standard Time) +package protocol + +// ImplementationClientCapabilities is: +type ImplementationClientCapabilities struct { + + /** TextDocument defined: + * The text document client capabilities + */ + TextDocument *struct { + + /** Implementation defined: + * Capabilities specific to the `textDocument/implementation` + */ + Implementation *struct { + + /** DynamicRegistration defined: + * Whether implementation supports dynamic registration. If this is set to `true` + * the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + * return value for the corresponding server capability as well. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + + /** LinkSupport defined: + * The client supports additional metadata in the form of definition links. + */ + LinkSupport bool `json:"linkSupport,omitempty"` + } `json:"implementation,omitempty"` + } `json:"textDocument,omitempty"` +} + +// ImplementationServerCapabilities is: +type ImplementationServerCapabilities struct { + + /** ImplementationProvider defined: + * The server provides Goto Implementation support. + */ + ImplementationProvider bool `json:"implementationProvider,omitempty"` // boolean | (TextDocumentRegistrationOptions & StaticRegistrationOptions) +} + +// TypeDefinitionClientCapabilities is: +type TypeDefinitionClientCapabilities struct { + + /** TextDocument defined: + * The text document client capabilities + */ + TextDocument *struct { + + /** TypeDefinition defined: + * Capabilities specific to the `textDocument/typeDefinition` + */ + TypeDefinition *struct { + + /** DynamicRegistration defined: + * Whether implementation supports dynamic registration. If this is set to `true` + * the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + * return value for the corresponding server capability as well. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + + /** LinkSupport defined: + * The client supports additional metadata in the form of definition links. + */ + LinkSupport bool `json:"linkSupport,omitempty"` + } `json:"typeDefinition,omitempty"` + } `json:"textDocument,omitempty"` +} + +// TypeDefinitionServerCapabilities is: +type TypeDefinitionServerCapabilities struct { + + /** TypeDefinitionProvider defined: + * The server provides Goto Type Definition support. + */ + TypeDefinitionProvider bool `json:"typeDefinitionProvider,omitempty"` // boolean | (TextDocumentRegistrationOptions & StaticRegistrationOptions) +} + +// WorkspaceFoldersInitializeParams is: +type WorkspaceFoldersInitializeParams struct { + + /** WorkspaceFolders defined: + * The actual configured workspace folders. + */ + WorkspaceFolders []WorkspaceFolder `json:"workspaceFolders"` +} + +// WorkspaceFoldersClientCapabilities is: +type WorkspaceFoldersClientCapabilities struct { + + /** Workspace defined: + * The workspace client capabilities + */ + Workspace *struct { + + /** WorkspaceFolders defined: + * The client has support for workspace folders + */ + WorkspaceFolders bool `json:"workspaceFolders,omitempty"` + } `json:"workspace,omitempty"` +} + +// WorkspaceFoldersServerCapabilities is: +type WorkspaceFoldersServerCapabilities struct { + + /** Workspace defined: + * The workspace server capabilities + */ + Workspace *struct { + + // WorkspaceFolders is + WorkspaceFolders *struct { + + /** Supported defined: + * The Server has support for workspace folders + */ + Supported bool `json:"supported,omitempty"` + + /** ChangeNotifications defined: + * Whether the server wants to receive workspace folder + * change notifications. + * + * If a strings is provided the string is treated as a ID + * under which the notification is registed on the client + * side. The ID can be used to unregister for these events + * using the `client/unregisterCapability` request. + */ + ChangeNotifications string `json:"changeNotifications,omitempty"` // string | boolean + } `json:"workspaceFolders,omitempty"` + } `json:"workspace,omitempty"` +} + +// WorkspaceFolder is: +type WorkspaceFolder struct { + + /** URI defined: + * The associated URI for this workspace folder. + */ + URI string `json:"uri"` + + /** Name defined: + * The name of the workspace folder. Used to refer to this + * workspace folder in thge user interface. + */ + Name string `json:"name"` +} + +// DidChangeWorkspaceFoldersParams is: +/** + * The parameters of a `workspace/didChangeWorkspaceFolders` notification. + */ +type DidChangeWorkspaceFoldersParams struct { + + /** Event defined: + * The actual workspace folder change event. + */ + Event WorkspaceFoldersChangeEvent `json:"event"` +} + +// WorkspaceFoldersChangeEvent is: +/** + * The workspace folder change event. + */ +type WorkspaceFoldersChangeEvent struct { + + /** Added defined: + * The array of added workspace folders + */ + Added []WorkspaceFolder `json:"added"` + + /** Removed defined: + * The array of the removed workspace folders + */ + Removed []WorkspaceFolder `json:"removed"` +} + +// ConfigurationClientCapabilities is: +type ConfigurationClientCapabilities struct { + + /** Workspace defined: + * The workspace client capabilities + */ + Workspace *struct { + + /** Configuration defined: + * The client supports `workspace/configuration` requests. + */ + Configuration bool `json:"configuration,omitempty"` + } `json:"workspace,omitempty"` +} + +// ConfigurationItem is: +type ConfigurationItem struct { + + /** ScopeURI defined: + * The scope to get the configuration section for. + */ + ScopeURI string `json:"scopeUri,omitempty"` + + /** Section defined: + * The configuration section asked for. + */ + Section string `json:"section,omitempty"` +} + +// ConfigurationParams is: +/** + * The parameters of a configuration request. + */ +type ConfigurationParams struct { + + // Items is + Items []ConfigurationItem `json:"items"` +} + +// ColorClientCapabilities is: +type ColorClientCapabilities struct { + + /** TextDocument defined: + * The text document client capabilities + */ + TextDocument *struct { + + /** ColorProvider defined: + * Capabilities specific to the colorProvider + */ + ColorProvider *struct { + + /** DynamicRegistration defined: + * Whether implementation supports dynamic registration. If this is set to `true` + * the client supports the new `(ColorProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)` + * return value for the corresponding server capability as well. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + } `json:"colorProvider,omitempty"` + } `json:"textDocument,omitempty"` +} + +// ColorProviderOptions is: +type ColorProviderOptions struct { +} + +// ColorServerCapabilities is: +type ColorServerCapabilities struct { + + /** ColorProvider defined: + * The server provides color provider support. + */ + ColorProvider bool `json:"colorProvider,omitempty"` // boolean | ColorProviderOptions | (ColorProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions) +} + +// DocumentColorParams is: +/** + * Parameters for a [DocumentColorRequest](#DocumentColorRequest). + */ +type DocumentColorParams struct { + + /** TextDocument defined: + * The text document. + */ + TextDocument TextDocumentIdentifier `json:"textDocument"` +} + +// ColorPresentationParams is: +/** + * Parameters for a [ColorPresentationRequest](#ColorPresentationRequest). + */ +type ColorPresentationParams struct { + + /** TextDocument defined: + * The text document. + */ + TextDocument TextDocumentIdentifier `json:"textDocument"` + + /** Color defined: + * The color to request presentations for. + */ + Color Color `json:"color"` + + /** Range defined: + * The range where the color would be inserted. Serves as a context. + */ + Range Range `json:"range"` +} + +// FoldingRangeClientCapabilities is: +type FoldingRangeClientCapabilities struct { + + /** TextDocument defined: + * The text document client capabilities + */ + TextDocument *struct { + + /** FoldingRange defined: + * Capabilities specific to `textDocument/foldingRange` requests + */ + FoldingRange *struct { + + /** DynamicRegistration defined: + * Whether implementation supports dynamic registration for folding range providers. If this is set to `true` + * the client supports the new `(FoldingRangeProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)` + * return value for the corresponding server capability as well. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + + /** RangeLimit defined: + * The maximum number of folding ranges that the client prefers to receive per document. The value serves as a + * hint, servers are free to follow the limit. + */ + RangeLimit float64 `json:"rangeLimit,omitempty"` + + /** LineFoldingOnly defined: + * If set, the client signals that it only supports folding complete lines. If set, client will + * ignore specified `startCharacter` and `endCharacter` properties in a FoldingRange. + */ + LineFoldingOnly bool `json:"lineFoldingOnly,omitempty"` + } `json:"foldingRange,omitempty"` + } `json:"textDocument,omitempty"` +} + +// FoldingRangeProviderOptions is: +type FoldingRangeProviderOptions struct { +} + +// FoldingRangeServerCapabilities is: +type FoldingRangeServerCapabilities struct { + + /** FoldingRangeProvider defined: + * The server provides folding provider support. + */ + FoldingRangeProvider bool `json:"foldingRangeProvider,omitempty"` // boolean | FoldingRangeProviderOptions | (FoldingRangeProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions) +} + +// FoldingRange is: +/** + * Represents a folding range. + */ +type FoldingRange struct { + + /** StartLine defined: + * The zero-based line number from where the folded range starts. + */ + StartLine float64 `json:"startLine"` + + /** StartCharacter defined: + * The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line. + */ + StartCharacter float64 `json:"startCharacter,omitempty"` + + /** EndLine defined: + * The zero-based line number where the folded range ends. + */ + EndLine float64 `json:"endLine"` + + /** EndCharacter defined: + * The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line. + */ + EndCharacter float64 `json:"endCharacter,omitempty"` + + /** Kind defined: + * Describes the kind of the folding range such as `comment' or 'region'. The kind + * is used to categorize folding ranges and used by commands like 'Fold all comments'. See + * [FoldingRangeKind](#FoldingRangeKind) for an enumeration of standardized kinds. + */ + Kind string `json:"kind,omitempty"` +} + +// FoldingRangeParams is: +/** + * Parameters for a [FoldingRangeRequest](#FoldingRangeRequest). + */ +type FoldingRangeParams struct { + + /** TextDocument defined: + * The text document. + */ + TextDocument TextDocumentIdentifier `json:"textDocument"` +} + +// DeclarationClientCapabilities is: +type DeclarationClientCapabilities struct { + + /** TextDocument defined: + * The text document client capabilities + */ + TextDocument *struct { + + /** Declaration defined: + * Capabilities specific to the `textDocument/declaration` + */ + Declaration *struct { + + /** DynamicRegistration defined: + * Whether declaration supports dynamic registration. If this is set to `true` + * the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` + * return value for the corresponding server capability as well. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + + /** LinkSupport defined: + * The client supports additional metadata in the form of declaration links. + */ + LinkSupport bool `json:"linkSupport,omitempty"` + } `json:"declaration,omitempty"` + } `json:"textDocument,omitempty"` +} + +// DeclarationServerCapabilities is: +type DeclarationServerCapabilities struct { + + /** DeclarationProvider defined: + * The server provides Goto Type Definition support. + */ + DeclarationProvider bool `json:"declarationProvider,omitempty"` // boolean | (TextDocumentRegistrationOptions & StaticRegistrationOptions) +} + +// SelectionRangeClientCapabilities is: +type SelectionRangeClientCapabilities struct { + + /** TextDocument defined: + * The text document client capabilities + */ + TextDocument *struct { + + /** 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"` +} + +// SelectionRangeProviderOptions is: +type SelectionRangeProviderOptions struct { +} + +// SelectionRangeServerCapabilities is: +type SelectionRangeServerCapabilities struct { + + /** SelectionRangeProvider defined: + * The server provides selection range support. + */ + SelectionRangeProvider bool `json:"selectionRangeProvider,omitempty"` // boolean | SelectionRangeProviderOptions | (SelectionRangeProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions) +} + +// SelectionRange is: +/** + * Represents a selection range + */ +type SelectionRange struct { + + /** Range defined: + * Range of the selection. + */ + Range Range `json:"range"` + + /** Kind defined: + * Describes the kind of the selection range such as `statemet' or 'declaration'. See + * [SelectionRangeKind](#SelectionRangeKind) for an enumeration of standardized kinds. + */ + Kind string `json:"kind"` +} + +// Registration is: +/** + * General parameters to to register for an notification or to register a provider. + */ +type Registration struct { + + /** ID defined: + * The id used to register the request. The id can be used to deregister + * the request again. + */ + ID string `json:"id"` + + /** Method defined: + * The method to register for. + */ + Method string `json:"method"` + + /** RegisterOptions defined: + * Options necessary for the registration. + */ + RegisterOptions interface{} `json:"registerOptions,omitempty"` +} + +// RegistrationParams is: +type RegistrationParams struct { + + // Registrations is + Registrations []Registration `json:"registrations"` +} + +// Unregistration is: +/** + * General parameters to unregister a request or notification. + */ +type Unregistration struct { + + /** ID defined: + * The id used to unregister the request or notification. Usually an id + * provided during the register request. + */ + ID string `json:"id"` + + /** Method defined: + * The method to unregister for. + */ + Method string `json:"method"` +} + +// UnregistrationParams is: +type UnregistrationParams struct { + + // Unregisterations is + Unregisterations []Unregistration `json:"unregisterations"` +} + +// TextDocumentPositionParams is: +/** + * A parameter literal used in requests to pass a text document and a position inside that + * document. + */ +type TextDocumentPositionParams struct { + + /** TextDocument defined: + * The text document. + */ + TextDocument TextDocumentIdentifier `json:"textDocument"` + + /** Position defined: + * The position inside the text document. + */ + Position Position `json:"position"` +} + +// WorkspaceClientCapabilities is: +/** + * Workspace specific client capabilities. + */ +type WorkspaceClientCapabilities struct { + + /** ApplyEdit defined: + * The client supports applying batch edits + * to the workspace by supporting the request + * 'workspace/applyEdit' + */ + ApplyEdit bool `json:"applyEdit,omitempty"` + + /** WorkspaceEdit defined: + * Capabilities specific to `WorkspaceEdit`s + */ + WorkspaceEdit *struct { + + /** DocumentChanges defined: + * The client supports versioned document changes in `WorkspaceEdit`s + */ + DocumentChanges bool `json:"documentChanges,omitempty"` + + /** ResourceOperations defined: + * The resource operations the client supports. Clients should at least + * support 'create', 'rename' and 'delete' files and folders. + */ + ResourceOperations []ResourceOperationKind `json:"resourceOperations,omitempty"` + + /** FailureHandling defined: + * The failure handling strategy of a client if applying the workspace edit + * failes. + */ + FailureHandling *FailureHandlingKind `json:"failureHandling,omitempty"` + } `json:"workspaceEdit,omitempty"` + + /** DidChangeConfiguration defined: + * Capabilities specific to the `workspace/didChangeConfiguration` notification. + */ + DidChangeConfiguration *struct { + + /** DynamicRegistration defined: + * Did change configuration notification supports dynamic registration. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + } `json:"didChangeConfiguration,omitempty"` + + /** DidChangeWatchedFiles defined: + * Capabilities specific to the `workspace/didChangeWatchedFiles` notification. + */ + DidChangeWatchedFiles *struct { + + /** DynamicRegistration defined: + * Did change watched files notification supports dynamic registration. Please note + * that the current protocol doesn't support static configuration for file changes + * from the server side. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + } `json:"didChangeWatchedFiles,omitempty"` + + /** Symbol defined: + * Capabilities specific to the `workspace/symbol` request. + */ + Symbol *struct { + + /** DynamicRegistration defined: + * Symbol request supports dynamic registration. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + + /** SymbolKind defined: + * Specific capabilities for the `SymbolKind` in the `workspace/symbol` request. + */ + SymbolKind *struct { + + /** ValueSet defined: + * The symbol kind values the client supports. When this + * property exists the client also guarantees that it will + * handle values outside its set gracefully and falls back + * to a default value when unknown. + * + * If this property is not present the client only supports + * the symbol kinds from `File` to `Array` as defined in + * the initial version of the protocol. + */ + ValueSet []SymbolKind `json:"valueSet,omitempty"` + } `json:"symbolKind,omitempty"` + } `json:"symbol,omitempty"` + + /** ExecuteCommand defined: + * Capabilities specific to the `workspace/executeCommand` request. + */ + ExecuteCommand *struct { + + /** DynamicRegistration defined: + * Execute command supports dynamic registration. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + } `json:"executeCommand,omitempty"` +} + +// TextDocumentClientCapabilities is: +/** + * Text document specific client capabilities. + */ +type TextDocumentClientCapabilities struct { + + /** Synchronization defined: + * Defines which synchronization capabilities the client supports. + */ + Synchronization *struct { + + /** DynamicRegistration defined: + * Whether text document synchronization supports dynamic registration. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + + /** WillSave defined: + * The client supports sending will save notifications. + */ + WillSave bool `json:"willSave,omitempty"` + + /** WillSaveWaitUntil defined: + * The client supports sending a will save request and + * waits for a response providing text edits which will + * be applied to the document before it is saved. + */ + WillSaveWaitUntil bool `json:"willSaveWaitUntil,omitempty"` + + /** DidSave defined: + * The client supports did save notifications. + */ + DidSave bool `json:"didSave,omitempty"` + } `json:"synchronization,omitempty"` + + /** Completion defined: + * Capabilities specific to the `textDocument/completion` + */ + Completion *struct { + + /** DynamicRegistration defined: + * Whether completion supports dynamic registration. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + + /** CompletionItem defined: + * The client supports the following `CompletionItem` specific + * capabilities. + */ + CompletionItem *struct { + + /** SnippetSupport defined: + * Client supports snippets as insert text. + * + * A snippet can define tab stops and placeholders with `$1`, `$2` + * and `${3:foo}`. `$0` defines the final tab stop, it defaults to + * the end of the snippet. Placeholders with equal identifiers are linked, + * that is typing in one will update others too. + */ + SnippetSupport bool `json:"snippetSupport,omitempty"` + + /** CommitCharactersSupport defined: + * Client supports commit characters on a completion item. + */ + CommitCharactersSupport bool `json:"commitCharactersSupport,omitempty"` + + /** DocumentationFormat defined: + * Client supports the follow content formats for the documentation + * property. The order describes the preferred format of the client. + */ + DocumentationFormat []MarkupKind `json:"documentationFormat,omitempty"` + + /** DeprecatedSupport defined: + * Client supports the deprecated property on a completion item. + */ + DeprecatedSupport bool `json:"deprecatedSupport,omitempty"` + + /** PreselectSupport defined: + * Client supports the preselect property on a completion item. + */ + PreselectSupport bool `json:"preselectSupport,omitempty"` + } `json:"completionItem,omitempty"` + + // CompletionItemKind is + CompletionItemKind *struct { + + /** ValueSet defined: + * The completion item kind values the client supports. When this + * property exists the client also guarantees that it will + * handle values outside its set gracefully and falls back + * to a default value when unknown. + * + * If this property is not present the client only supports + * the completion items kinds from `Text` to `Reference` as defined in + * the initial version of the protocol. + */ + ValueSet []CompletionItemKind `json:"valueSet,omitempty"` + } `json:"completionItemKind,omitempty"` + + /** ContextSupport defined: + * The client supports to send additional context information for a + * `textDocument/completion` requestion. + */ + ContextSupport bool `json:"contextSupport,omitempty"` + } `json:"completion,omitempty"` + + /** Hover defined: + * Capabilities specific to the `textDocument/hover` + */ + Hover *struct { + + /** DynamicRegistration defined: + * Whether hover supports dynamic registration. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + + /** ContentFormat defined: + * Client supports the follow content formats for the content + * property. The order describes the preferred format of the client. + */ + ContentFormat []MarkupKind `json:"contentFormat,omitempty"` + } `json:"hover,omitempty"` + + /** SignatureHelp defined: + * Capabilities specific to the `textDocument/signatureHelp` + */ + SignatureHelp *struct { + + /** DynamicRegistration defined: + * Whether signature help supports dynamic registration. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + + /** SignatureInformation defined: + * The client supports the following `SignatureInformation` + * specific properties. + */ + SignatureInformation *struct { + + /** DocumentationFormat defined: + * Client supports the follow content formats for the documentation + * property. The order describes the preferred format of the client. + */ + DocumentationFormat []MarkupKind `json:"documentationFormat,omitempty"` + + /** ParameterInformation defined: + * Client capabilities specific to parameter information. + */ + ParameterInformation *struct { + + /** LabelOffsetSupport defined: + * The client supports processing label offsets instead of a + * simple label string. + */ + LabelOffsetSupport bool `json:"labelOffsetSupport,omitempty"` + } `json:"parameterInformation,omitempty"` + } `json:"signatureInformation,omitempty"` + } `json:"signatureHelp,omitempty"` + + /** References defined: + * Capabilities specific to the `textDocument/references` + */ + References *struct { + + /** DynamicRegistration defined: + * Whether references supports dynamic registration. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + } `json:"references,omitempty"` + + /** DocumentHighlight defined: + * Capabilities specific to the `textDocument/documentHighlight` + */ + DocumentHighlight *struct { + + /** DynamicRegistration defined: + * Whether document highlight supports dynamic registration. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + } `json:"documentHighlight,omitempty"` + + /** DocumentSymbol defined: + * Capabilities specific to the `textDocument/documentSymbol` + */ + DocumentSymbol *struct { + + /** DynamicRegistration defined: + * Whether document symbol supports dynamic registration. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + + /** SymbolKind defined: + * Specific capabilities for the `SymbolKind`. + */ + SymbolKind *struct { + + /** ValueSet defined: + * The symbol kind values the client supports. When this + * property exists the client also guarantees that it will + * handle values outside its set gracefully and falls back + * to a default value when unknown. + * + * If this property is not present the client only supports + * the symbol kinds from `File` to `Array` as defined in + * the initial version of the protocol. + */ + ValueSet []SymbolKind `json:"valueSet,omitempty"` + } `json:"symbolKind,omitempty"` + + /** HierarchicalDocumentSymbolSupport defined: + * The client support hierarchical document symbols. + */ + HierarchicalDocumentSymbolSupport bool `json:"hierarchicalDocumentSymbolSupport,omitempty"` + } `json:"documentSymbol,omitempty"` + + /** Formatting defined: + * Capabilities specific to the `textDocument/formatting` + */ + Formatting *struct { + + /** DynamicRegistration defined: + * Whether formatting supports dynamic registration. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + } `json:"formatting,omitempty"` + + /** RangeFormatting defined: + * Capabilities specific to the `textDocument/rangeFormatting` + */ + RangeFormatting *struct { + + /** DynamicRegistration defined: + * Whether range formatting supports dynamic registration. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + } `json:"rangeFormatting,omitempty"` + + /** OnTypeFormatting defined: + * Capabilities specific to the `textDocument/onTypeFormatting` + */ + OnTypeFormatting *struct { + + /** DynamicRegistration defined: + * Whether on type formatting supports dynamic registration. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + } `json:"onTypeFormatting,omitempty"` + + /** Definition defined: + * Capabilities specific to the `textDocument/definition` + */ + Definition *struct { + + /** DynamicRegistration defined: + * Whether definition supports dynamic registration. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + + /** LinkSupport defined: + * The client supports additional metadata in the form of definition links. + */ + LinkSupport bool `json:"linkSupport,omitempty"` + } `json:"definition,omitempty"` + + /** CodeAction defined: + * Capabilities specific to the `textDocument/codeAction` + */ + CodeAction *struct { + + /** DynamicRegistration defined: + * Whether code action supports dynamic registration. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + + /** CodeActionLiteralSupport defined: + * The client support code action literals as a valid + * response of the `textDocument/codeAction` request. + */ + CodeActionLiteralSupport *struct { + + /** CodeActionKind defined: + * The code action kind is support with the following value + * set. + */ + CodeActionKind struct { + + /** ValueSet defined: + * The code action kind values the client supports. When this + * property exists the client also guarantees that it will + * handle values outside its set gracefully and falls back + * to a default value when unknown. + */ + ValueSet []CodeActionKind `json:"valueSet"` + } `json:"codeActionKind"` + } `json:"codeActionLiteralSupport,omitempty"` + } `json:"codeAction,omitempty"` + + /** CodeLens defined: + * Capabilities specific to the `textDocument/codeLens` + */ + CodeLens *struct { + + /** DynamicRegistration defined: + * Whether code lens supports dynamic registration. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + } `json:"codeLens,omitempty"` + + /** DocumentLink defined: + * Capabilities specific to the `textDocument/documentLink` + */ + DocumentLink *struct { + + /** DynamicRegistration defined: + * Whether document link supports dynamic registration. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + } `json:"documentLink,omitempty"` + + /** Rename defined: + * Capabilities specific to the `textDocument/rename` + */ + Rename *struct { + + /** DynamicRegistration defined: + * Whether rename supports dynamic registration. + */ + DynamicRegistration bool `json:"dynamicRegistration,omitempty"` + + /** PrepareSupport defined: + * Client supports testing for validity of rename operations + * before execution. + */ + PrepareSupport bool `json:"prepareSupport,omitempty"` + } `json:"rename,omitempty"` + + /** PublishDiagnostics defined: + * Capabilities specific to `textDocument/publishDiagnostics`. + */ + PublishDiagnostics *struct { + + /** RelatedInformation defined: + * Whether the clients accepts diagnostics with related information. + */ + RelatedInformation bool `json:"relatedInformation,omitempty"` + + /** TagSupport defined: + * Client supports the tag property to provide meta data about a diagnostic. + */ + TagSupport bool `json:"tagSupport,omitempty"` + } `json:"publishDiagnostics,omitempty"` +} + +// InnerClientCapabilities is: +/** + * Defines the capabilities provided by the client. + */ +type InnerClientCapabilities struct { + + /** Workspace defined: + * Workspace specific client capabilities. + */ + Workspace *WorkspaceClientCapabilities `json:"workspace,omitempty"` + + /** TextDocument defined: + * Text document specific client capabilities. + */ + TextDocument *TextDocumentClientCapabilities `json:"textDocument,omitempty"` + + /** Experimental defined: + * Experimental client capabilities. + */ + Experimental interface{} `json:"experimental,omitempty"` +} + +// ClientCapabilities is: +type ClientCapabilities struct { + InnerClientCapabilities + ImplementationClientCapabilities + TypeDefinitionClientCapabilities + WorkspaceFoldersClientCapabilities + ConfigurationClientCapabilities + ColorClientCapabilities + FoldingRangeClientCapabilities + DeclarationClientCapabilities + SelectionRangeClientCapabilities +} + +// StaticRegistrationOptions is: +/** + * Static registration options to be returned in the initialize + * request. + */ +type StaticRegistrationOptions struct { + + /** ID defined: + * The id used to register the request. The id can be used to deregister + * the request again. See also Registration#id. + */ + ID string `json:"id,omitempty"` +} + +// TextDocumentRegistrationOptions is: +/** + * General text document registration options. + */ +type TextDocumentRegistrationOptions struct { + + /** DocumentSelector defined: + * A document selector to identify the scope of the registration. If set to null + * the document selector provided on the client side will be used. + */ + DocumentSelector DocumentSelector `json:"documentSelector"` +} + +// CompletionOptions is: +/** + * Completion options. + */ +type CompletionOptions struct { + + /** TriggerCharacters defined: + * Most tools trigger completion request automatically without explicitly requesting + * it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user + * starts to type an identifier. For example if the user types `c` in a JavaScript file + * code complete will automatically pop up present `console` besides others as a + * completion item. Characters that make up identifiers don't need to be listed here. + * + * If code complete should automatically be trigger on characters not being valid inside + * an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. + */ + TriggerCharacters []string `json:"triggerCharacters,omitempty"` + + /** AllCommitCharacters defined: + * The list of all possible characters that commit a completion. This field can be used + * if clients don't support individual commmit characters per completion item. See + * `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` + */ + AllCommitCharacters []string `json:"allCommitCharacters,omitempty"` + + /** ResolveProvider defined: + * The server provides support to resolve additional + * information for a completion item. + */ + ResolveProvider bool `json:"resolveProvider,omitempty"` +} + +// SignatureHelpOptions is: +/** + * Signature help options. + */ +type SignatureHelpOptions struct { + + /** TriggerCharacters defined: + * The characters that trigger signature help + * automatically. + */ + TriggerCharacters []string `json:"triggerCharacters,omitempty"` +} + +// CodeActionOptions is: +/** + * Code Action options. + */ +type CodeActionOptions struct { + + /** CodeActionKinds defined: + * CodeActionKinds that this server may return. + * + * The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server + * may list out every specific kind they provide. + */ + CodeActionKinds []CodeActionKind `json:"codeActionKinds,omitempty"` +} + +// CodeLensOptions is: +/** + * Code Lens options. + */ +type CodeLensOptions struct { + + /** ResolveProvider defined: + * Code lens has a resolve provider as well. + */ + ResolveProvider bool `json:"resolveProvider,omitempty"` +} + +// DocumentOnTypeFormattingOptions is: +/** + * Format document on type options + */ +type DocumentOnTypeFormattingOptions struct { + + /** FirstTriggerCharacter defined: + * A character on which formatting should be triggered, like `}`. + */ + FirstTriggerCharacter string `json:"firstTriggerCharacter"` + + /** MoreTriggerCharacter defined: + * More trigger characters. + */ + MoreTriggerCharacter []string `json:"moreTriggerCharacter,omitempty"` +} + +// RenameOptions is: +/** + * Rename options + */ +type RenameOptions struct { + + /** PrepareProvider defined: + * Renames should be checked and tested before being executed. + */ + PrepareProvider bool `json:"prepareProvider,omitempty"` +} + +// DocumentLinkOptions is: +/** + * Document link options + */ +type DocumentLinkOptions struct { + + /** ResolveProvider defined: + * Document links have a resolve provider as well. + */ + ResolveProvider bool `json:"resolveProvider,omitempty"` +} + +// ExecuteCommandOptions is: +/** + * Execute command options. + */ +type ExecuteCommandOptions struct { + + /** Commands defined: + * The commands to be executed on the server + */ + Commands []string `json:"commands"` +} + +// SaveOptions is: +/** + * Save options. + */ +type SaveOptions struct { + + /** IncludeText defined: + * The client is supposed to include the content on save. + */ + IncludeText bool `json:"includeText,omitempty"` +} + +// TextDocumentSyncOptions is: +type TextDocumentSyncOptions struct { + + /** OpenClose defined: + * Open and close notifications are sent to the server. + */ + OpenClose bool `json:"openClose,omitempty"` + + /** Change defined: + * Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full + * and TextDocumentSyncKind.Incremental. + */ + Change TextDocumentSyncKind `json:"change,omitempty"` + + /** WillSave defined: + * Will save notifications are sent to the server. + */ + WillSave bool `json:"willSave,omitempty"` + + /** WillSaveWaitUntil defined: + * Will save wait until requests are sent to the server. + */ + WillSaveWaitUntil bool `json:"willSaveWaitUntil,omitempty"` + + /** Save defined: + * Save notifications are sent to the server. + */ + Save *SaveOptions `json:"save,omitempty"` +} + +// InnerServerCapabilities is: +/** + * Defines the capabilities provided by a language + * server. + */ +type InnerServerCapabilities struct { + + /** TextDocumentSync defined: + * Defines how text documents are synced. Is either a detailed structure defining each notification or + * for backwards compatibility the TextDocumentSyncKind number. + */ + TextDocumentSync interface{} `json:"textDocumentSync,omitempty"` // TextDocumentSyncOptions | TextDocumentSyncKind + + /** HoverProvider defined: + * The server provides hover support. + */ + HoverProvider bool `json:"hoverProvider,omitempty"` + + /** CompletionProvider defined: + * The server provides completion support. + */ + CompletionProvider *CompletionOptions `json:"completionProvider,omitempty"` + + /** SignatureHelpProvider defined: + * The server provides signature help support. + */ + SignatureHelpProvider *SignatureHelpOptions `json:"signatureHelpProvider,omitempty"` + + /** DefinitionProvider defined: + * The server provides goto definition support. + */ + DefinitionProvider bool `json:"definitionProvider,omitempty"` + + /** ReferencesProvider defined: + * The server provides find references support. + */ + ReferencesProvider bool `json:"referencesProvider,omitempty"` + + /** DocumentHighlightProvider defined: + * The server provides document highlight support. + */ + DocumentHighlightProvider bool `json:"documentHighlightProvider,omitempty"` + + /** DocumentSymbolProvider defined: + * The server provides document symbol support. + */ + DocumentSymbolProvider bool `json:"documentSymbolProvider,omitempty"` + + /** WorkspaceSymbolProvider defined: + * The server provides workspace symbol support. + */ + WorkspaceSymbolProvider bool `json:"workspaceSymbolProvider,omitempty"` + + /** CodeActionProvider defined: + * The server provides code actions. CodeActionOptions may only be + * specified if the client states that it supports + * `codeActionLiteralSupport` in its initial `initialize` request. + */ + CodeActionProvider bool `json:"codeActionProvider,omitempty"` // boolean | CodeActionOptions + + /** CodeLensProvider defined: + * The server provides code lens. + */ + CodeLensProvider *CodeLensOptions `json:"codeLensProvider,omitempty"` + + /** DocumentFormattingProvider defined: + * The server provides document formatting. + */ + DocumentFormattingProvider bool `json:"documentFormattingProvider,omitempty"` + + /** DocumentRangeFormattingProvider defined: + * The server provides document range formatting. + */ + DocumentRangeFormattingProvider bool `json:"documentRangeFormattingProvider,omitempty"` + + /** DocumentOnTypeFormattingProvider defined: + * The server provides document formatting on typing. + */ + DocumentOnTypeFormattingProvider *struct { + + /** FirstTriggerCharacter defined: + * A character on which formatting should be triggered, like `}`. + */ + FirstTriggerCharacter string `json:"firstTriggerCharacter"` + + /** MoreTriggerCharacter defined: + * More trigger characters. + */ + MoreTriggerCharacter []string `json:"moreTriggerCharacter,omitempty"` + } `json:"documentOnTypeFormattingProvider,omitempty"` + + /** RenameProvider defined: + * The server provides rename support. RenameOptions may only be + * specified if the client states that it supports + * `prepareSupport` in its initial `initialize` request. + */ + RenameProvider bool `json:"renameProvider,omitempty"` // boolean | RenameOptions + + /** DocumentLinkProvider defined: + * The server provides document link support. + */ + DocumentLinkProvider *DocumentLinkOptions `json:"documentLinkProvider,omitempty"` + + /** ExecuteCommandProvider defined: + * The server provides execute command support. + */ + ExecuteCommandProvider *ExecuteCommandOptions `json:"executeCommandProvider,omitempty"` + + /** Experimental defined: + * Experimental server capabilities. + */ + Experimental interface{} `json:"experimental,omitempty"` +} + +// ServerCapabilities is: +type ServerCapabilities struct { + InnerServerCapabilities + ImplementationServerCapabilities + TypeDefinitionServerCapabilities + WorkspaceFoldersServerCapabilities + ColorServerCapabilities + FoldingRangeServerCapabilities + DeclarationServerCapabilities + SelectionRangeServerCapabilities +} + +// InnerInitializeParams is: +/** + * The initialize parameters + */ +type InnerInitializeParams struct { + + /** ProcessID defined: + * The process Id of the parent process that started + * the server. + */ + ProcessID float64 `json:"processId"` + + /** RootPath defined: + * The rootPath of the workspace. Is null + * if no folder is open. + * + * @deprecated in favour of rootUri. + */ + RootPath string `json:"rootPath,omitempty"` + + /** RootURI defined: + * The rootUri of the workspace. Is null if no + * folder is open. If both `rootPath` and `rootUri` are set + * `rootUri` wins. + * + * @deprecated in favour of workspaceFolders. + */ + RootURI string `json:"rootUri"` + + /** Capabilities defined: + * The capabilities provided by the client (editor or tool) + */ + Capabilities ClientCapabilities `json:"capabilities"` + + /** InitializationOptions defined: + * User provided initialization options. + */ + InitializationOptions interface{} `json:"initializationOptions,omitempty"` + + /** Trace defined: + * The initial trace setting. If omitted trace is disabled ('off'). + */ + Trace string `json:"trace,omitempty"` // 'off' | 'messages' | 'verbose' +} + +// InitializeParams is: +type InitializeParams struct { + InnerInitializeParams + WorkspaceFoldersInitializeParams +} + +// InitializeResult is: +/** + * The result returned from an initialize request. + */ +type InitializeResult struct { + + /** Capabilities defined: + * The capabilities the language server provides. + */ + Capabilities ServerCapabilities `json:"capabilities"` + + /** Custom defined: + * Custom initialization results. + */ + Custom map[string]interface{} `json:"custom"` // [custom: string]: any; +} + +// InitializedParams is: +type InitializedParams struct { +} + +// DidChangeConfigurationRegistrationOptions is: +type DidChangeConfigurationRegistrationOptions struct { + + // Section is + Section string `json:"section,omitempty"` // string | string[] +} + +// DidChangeConfigurationParams is: +/** + * The parameters of a change configuration notification. + */ +type DidChangeConfigurationParams struct { + + /** Settings defined: + * The actual changed settings + */ + Settings interface{} `json:"settings"` +} + +// ShowMessageParams is: +/** + * The parameters of a notification message. + */ +type ShowMessageParams struct { + + /** Type defined: + * The message type. See {@link MessageType} + */ + Type MessageType `json:"type"` + + /** Message defined: + * The actual message + */ + Message string `json:"message"` +} + +// MessageActionItem is: +type MessageActionItem struct { + + /** Title defined: + * A short title like 'Retry', 'Open Log' etc. + */ + Title string `json:"title"` +} + +// ShowMessageRequestParams is: +type ShowMessageRequestParams struct { + + /** Type defined: + * The message type. See {@link MessageType} + */ + Type MessageType `json:"type"` + + /** Message defined: + * The actual message + */ + Message string `json:"message"` + + /** Actions defined: + * The message action items to present. + */ + Actions []MessageActionItem `json:"actions,omitempty"` +} + +// LogMessageParams is: +/** + * The log message parameters. + */ +type LogMessageParams struct { + + /** Type defined: + * The message type. See {@link MessageType} + */ + Type MessageType `json:"type"` + + /** Message defined: + * The actual message + */ + Message string `json:"message"` +} + +// DidOpenTextDocumentParams is: +/** + * The parameters send in a open text document notification + */ +type DidOpenTextDocumentParams struct { + + /** TextDocument defined: + * The document that was opened. + */ + TextDocument TextDocumentItem `json:"textDocument"` +} + +// DidChangeTextDocumentParams is: +/** + * The change text document notification's parameters. + */ +type DidChangeTextDocumentParams struct { + + /** TextDocument defined: + * The document that did change. The version number points + * to the version after all provided content changes have + * been applied. + */ + TextDocument VersionedTextDocumentIdentifier `json:"textDocument"` + + /** ContentChanges defined: + * The actual content changes. The content changes describe single state changes + * to the document. So if there are two content changes c1 and c2 for a document + * in state S then c1 move the document to S' and c2 to S''. + */ + ContentChanges []TextDocumentContentChangeEvent `json:"contentChanges"` +} + +// TextDocumentChangeRegistrationOptions is: +/** + * Describe options to be used when registered for text document change events. + */ +type TextDocumentChangeRegistrationOptions struct { + TextDocumentRegistrationOptions + + /** SyncKind defined: + * How documents are synced to the server. + */ + SyncKind TextDocumentSyncKind `json:"syncKind"` +} + +// DidCloseTextDocumentParams is: +/** + * The parameters send in a close text document notification + */ +type DidCloseTextDocumentParams struct { + + /** TextDocument defined: + * The document that was closed. + */ + TextDocument TextDocumentIdentifier `json:"textDocument"` +} + +// DidSaveTextDocumentParams is: +/** + * The parameters send in a save text document notification + */ +type DidSaveTextDocumentParams struct { + + /** TextDocument defined: + * The document that was closed. + */ + TextDocument VersionedTextDocumentIdentifier `json:"textDocument"` + + /** Text defined: + * Optional the content when saved. Depends on the includeText value + * when the save notification was requested. + */ + Text string `json:"text,omitempty"` +} + +// TextDocumentSaveRegistrationOptions is: +/** + * Save registration options. + */ +type TextDocumentSaveRegistrationOptions struct { + TextDocumentRegistrationOptions + SaveOptions +} + +// WillSaveTextDocumentParams is: +/** + * The parameters send in a will save text document notification. + */ +type WillSaveTextDocumentParams struct { + + /** TextDocument defined: + * The document that will be saved. + */ + TextDocument TextDocumentIdentifier `json:"textDocument"` + + /** Reason defined: + * The 'TextDocumentSaveReason'. + */ + Reason TextDocumentSaveReason `json:"reason"` +} + +// DidChangeWatchedFilesParams is: +/** + * The watched files change notification's parameters. + */ +type DidChangeWatchedFilesParams struct { + + /** Changes defined: + * The actual file events. + */ + Changes []FileEvent `json:"changes"` +} + +// FileEvent is: +/** + * An event describing a file change. + */ +type FileEvent struct { + + /** URI defined: + * The file's uri. + */ + URI string `json:"uri"` + + /** Type defined: + * The change type. + */ + Type FileChangeType `json:"type"` +} + +// DidChangeWatchedFilesRegistrationOptions is: +/** + * Describe options to be used when registered for text document change events. + */ +type DidChangeWatchedFilesRegistrationOptions struct { + + /** Watchers defined: + * The watchers to register. + */ + Watchers []FileSystemWatcher `json:"watchers"` +} + +// FileSystemWatcher is: +type FileSystemWatcher struct { + + /** GlobPattern defined: + * The glob pattern to watch. 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 conditions (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`) + */ + GlobPattern string `json:"globPattern"` + + /** Kind defined: + * The kind of events of interest. If omitted it defaults + * to WatchKind.Create | WatchKind.Change | WatchKind.Delete + * which is 7. + */ + Kind float64 `json:"kind,omitempty"` +} + +// PublishDiagnosticsParams is: +/** + * The publish diagnostic notification's parameters. + */ +type PublishDiagnosticsParams struct { + + /** URI defined: + * The URI for which diagnostic information is reported. + */ + URI string `json:"uri"` + + /** Version defined: + * Optional the version number of the document the diagnostics are published for. + */ + Version float64 `json:"version,omitempty"` + + /** Diagnostics defined: + * An array of diagnostic information items. + */ + Diagnostics []Diagnostic `json:"diagnostics"` +} + +// CompletionRegistrationOptions is: +/** + * Completion registration options. + */ +type CompletionRegistrationOptions struct { + TextDocumentRegistrationOptions + CompletionOptions +} + +// CompletionContext is: +/** + * Contains additional information about the context in which a completion request is triggered. + */ +type CompletionContext struct { + + /** TriggerKind defined: + * How the completion was triggered. + */ + TriggerKind CompletionTriggerKind `json:"triggerKind"` + + /** TriggerCharacter defined: + * The trigger character (a single character) that has trigger code complete. + * Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter` + */ + TriggerCharacter string `json:"triggerCharacter,omitempty"` +} + +// CompletionParams is: +/** + * Completion parameters + */ +type CompletionParams struct { + TextDocumentPositionParams + + /** Context defined: + * The completion context. This is only available it the client specifies + * to send this using `ClientCapabilities.textDocument.completion.contextSupport === true` + */ + Context *CompletionContext `json:"context,omitempty"` +} + +// SignatureHelpRegistrationOptions is: +/** + * Signature help registration options. + */ +type SignatureHelpRegistrationOptions struct { + TextDocumentRegistrationOptions + SignatureHelpOptions +} + +// ReferenceParams is: +/** + * Parameters for a [ReferencesRequest](#ReferencesRequest). + */ +type ReferenceParams struct { + TextDocumentPositionParams + + // Context is + Context ReferenceContext `json:"context"` +} + +// CodeActionParams is: +/** + * Params for the CodeActionRequest + */ +type CodeActionParams struct { + + /** TextDocument defined: + * The document in which the command was invoked. + */ + TextDocument TextDocumentIdentifier `json:"textDocument"` + + /** Range defined: + * The range for which the command was invoked. + */ + Range Range `json:"range"` + + /** Context defined: + * Context carrying additional information. + */ + Context CodeActionContext `json:"context"` +} + +// CodeActionRegistrationOptions is: +type CodeActionRegistrationOptions struct { + TextDocumentRegistrationOptions + CodeActionOptions +} + +// CodeLensParams is: +/** + * Params for the Code Lens request. + */ +type CodeLensParams struct { + + /** TextDocument defined: + * The document to request code lens for. + */ + TextDocument TextDocumentIdentifier `json:"textDocument"` +} + +// CodeLensRegistrationOptions is: +/** + * Code Lens registration options. + */ +type CodeLensRegistrationOptions struct { + TextDocumentRegistrationOptions + CodeLensOptions +} + +// DocumentFormattingParams is: +type DocumentFormattingParams struct { + + /** TextDocument defined: + * The document to format. + */ + TextDocument TextDocumentIdentifier `json:"textDocument"` + + /** Options defined: + * The format options + */ + Options FormattingOptions `json:"options"` +} + +// DocumentRangeFormattingParams is: +type DocumentRangeFormattingParams struct { + + /** TextDocument defined: + * The document to format. + */ + TextDocument TextDocumentIdentifier `json:"textDocument"` + + /** Range defined: + * The range to format + */ + Range Range `json:"range"` + + /** Options defined: + * The format options + */ + Options FormattingOptions `json:"options"` +} + +// DocumentOnTypeFormattingParams is: +type DocumentOnTypeFormattingParams struct { + + /** TextDocument defined: + * The document to format. + */ + TextDocument TextDocumentIdentifier `json:"textDocument"` + + /** Position defined: + * The position at which this request was send. + */ + Position Position `json:"position"` + + /** Ch defined: + * The character that has been typed. + */ + Ch string `json:"ch"` + + /** Options defined: + * The format options. + */ + Options FormattingOptions `json:"options"` +} + +// DocumentOnTypeFormattingRegistrationOptions is: +/** + * Format document on type options + */ +type DocumentOnTypeFormattingRegistrationOptions struct { + TextDocumentRegistrationOptions + DocumentOnTypeFormattingOptions +} + +// RenameParams is: +type RenameParams struct { + + /** TextDocument defined: + * The document to rename. + */ + TextDocument TextDocumentIdentifier `json:"textDocument"` + + /** Position defined: + * The position at which this request was sent. + */ + Position Position `json:"position"` + + /** NewName defined: + * The new name of the symbol. If the given name is not valid the + * request must return a [ResponseError](#ResponseError) with an + * appropriate message set. + */ + NewName string `json:"newName"` +} + +// RenameRegistrationOptions is: +/** + * Rename registration options. + */ +type RenameRegistrationOptions struct { + TextDocumentRegistrationOptions + RenameOptions +} + +// DocumentLinkParams is: +type DocumentLinkParams struct { + + /** TextDocument defined: + * The document to provide document links for. + */ + TextDocument TextDocumentIdentifier `json:"textDocument"` +} + +// DocumentLinkRegistrationOptions is: +/** + * Document link registration options + */ +type DocumentLinkRegistrationOptions struct { + TextDocumentRegistrationOptions + DocumentLinkOptions +} + +// ExecuteCommandParams is: +type ExecuteCommandParams struct { + + /** Command defined: + * The identifier of the actual command handler. + */ + Command string `json:"command"` + + /** Arguments defined: + * Arguments that the command should be invoked with. + */ + Arguments []interface{} `json:"arguments,omitempty"` +} + +// ExecuteCommandRegistrationOptions is: +/** + * Execute command registration options. + */ +type ExecuteCommandRegistrationOptions struct { + ExecuteCommandOptions +} + +// ApplyWorkspaceEditParams is: +/** + * The parameters passed via a apply workspace edit request. + */ +type ApplyWorkspaceEditParams struct { + + /** Label defined: + * An optional label of the workspace edit. This label is + * presented in the user interface for example on an undo + * stack to undo the workspace edit. + */ + Label string `json:"label,omitempty"` + + /** Edit defined: + * The edits to apply. + */ + Edit WorkspaceEdit `json:"edit"` +} + +// ApplyWorkspaceEditResponse is: +/** + * A response returned from the apply workspace edit request. + */ +type ApplyWorkspaceEditResponse struct { + + /** Applied defined: + * Indicates whether the edit was applied or not. + */ + Applied bool `json:"applied"` + + /** FailureReason defined: + * An optional textual description for why the edit was not applied. + * This may be used by the server for diagnostic logging or to provide + * a suitable error for a request that triggered the edit. + */ + FailureReason string `json:"failureReason,omitempty"` + + /** FailedChange defined: + * Depending on the client's failure handling strategy `failedChange` might + * contain the index of the change that failed. This property is only available + * if the client signals a `failureHandlingStrategy` in its client capabilities. + */ + FailedChange float64 `json:"failedChange,omitempty"` +} + +// Position is: +/** + * Position in a text document expressed as zero-based line and character offset. + * The offsets are based on a UTF-16 string representation. So a string of the form + * `a𐐀b` the character offset of the character `a` is 0, the character offset of `𐐀` + * is 1 and the character offset of b is 3 since `𐐀` is represented using two code + * units in UTF-16. + * + * Positions are line end character agnostic. So you can not specify a position that + * denotes `\r|\n` or `\n|` where `|` represents the character offset. + */ +type Position struct { + + /** Line defined: + * Line position in a document (zero-based). + * If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document. + * If a line number is negative, it defaults to 0. + */ + Line float64 `json:"line"` + + /** Character defined: + * Character offset on a line in a document (zero-based). Assuming that the line is + * represented as a string, the `character` value represents the gap between the + * `character` and `character + 1`. + * + * If the character value is greater than the line length it defaults back to the + * line length. + * If a line number is negative, it defaults to 0. + */ + Character float64 `json:"character"` +} + +// Range is: +/** + * A range in a text document expressed as (zero-based) start and end positions. + * + * If you want to specify a range that contains a line including the line ending + * character(s) then use an end position denoting the start of the next line. + * For example: + * ```ts + * { + * start: { line: 5, character: 23 } + * end : { line 6, character : 0 } + * } + * ``` + */ +type Range struct { + + /** Start defined: + * The range's start position + */ + Start Position `json:"start"` + + /** End defined: + * The range's end position. + */ + End Position `json:"end"` +} + +// Location is: +/** + * Represents a location inside a resource, such as a line + * inside a text file. + */ +type Location struct { + + // URI is + URI string `json:"uri"` + + // Range is + Range Range `json:"range"` +} + +// LocationLink is: +/** + * Represents the connection of two locations. Provides additional metadata over normal [locations](#Location), + * including an origin range. + */ +type LocationLink struct { + + /** OriginSelectionRange defined: + * Span of the origin of this link. + * + * Used as the underlined span for mouse definition hover. Defaults to the word range at + * the definition position. + */ + OriginSelectionRange *Range `json:"originSelectionRange,omitempty"` + + /** TargetURI defined: + * The target resource identifier of this link. + */ + TargetURI string `json:"targetUri"` + + /** TargetRange defined: + * The full target range of this link. If the target for example is a symbol then target range is the + * range enclosing this symbol not including leading/trailing whitespace but everything else + * like comments. This information is typically used to highlight the range in the editor. + */ + TargetRange Range `json:"targetRange"` + + /** TargetSelectionRange defined: + * The range that should be selected and revealed when this link is being followed, e.g the name of a function. + * Must be contained by the the `targetRange`. See also `DocumentSymbol#range` + */ + TargetSelectionRange Range `json:"targetSelectionRange"` +} + +// Color is: +/** + * Represents a color in RGBA space. + */ +type Color struct { + + /** Red defined: + * The red component of this color in the range [0-1]. + */ + Red float64 `json:"red"` + + /** Green defined: + * The green component of this color in the range [0-1]. + */ + Green float64 `json:"green"` + + /** Blue defined: + * The blue component of this color in the range [0-1]. + */ + Blue float64 `json:"blue"` + + /** Alpha defined: + * The alpha component of this color in the range [0-1]. + */ + Alpha float64 `json:"alpha"` +} + +// ColorInformation is: +/** + * Represents a color range from a document. + */ +type ColorInformation struct { + + /** Range defined: + * The range in the document where this color appers. + */ + Range Range `json:"range"` + + /** Color defined: + * The actual color value for this color range. + */ + Color Color `json:"color"` +} + +// ColorPresentation is: +type ColorPresentation struct { + + /** Label defined: + * The label of this color presentation. It will be shown on the color + * picker header. By default this is also the text that is inserted when selecting + * this color presentation. + */ + Label string `json:"label"` + + /** TextEdit defined: + * An [edit](#TextEdit) which is applied to a document when selecting + * this presentation for the color. When `falsy` the [label](#ColorPresentation.label) + * is used. + */ + TextEdit *TextEdit `json:"textEdit,omitempty"` + + /** AdditionalTextEdits defined: + * An optional array of additional [text edits](#TextEdit) that are applied when + * selecting this color presentation. Edits must not overlap with the main [edit](#ColorPresentation.textEdit) nor with themselves. + */ + AdditionalTextEdits []TextEdit `json:"additionalTextEdits,omitempty"` +} + +// DiagnosticRelatedInformation is: +/** + * Represents a related message and source code location for a diagnostic. This should be + * used to point to code locations that cause or related to a diagnostics, e.g when duplicating + * a symbol in a scope. + */ +type DiagnosticRelatedInformation struct { + + /** Location defined: + * The location of this related diagnostic information. + */ + Location Location `json:"location"` + + /** Message defined: + * The message of this related diagnostic information. + */ + Message string `json:"message"` +} + +// Diagnostic is: +/** + * Represents a diagnostic, such as a compiler error or warning. Diagnostic objects + * are only valid in the scope of a resource. + */ +type Diagnostic struct { + + /** Range defined: + * The range at which the message applies + */ + Range Range `json:"range"` + + /** Severity defined: + * The diagnostic's severity. Can be omitted. If omitted it is up to the + * client to interpret diagnostics as error, warning, info or hint. + */ + Severity DiagnosticSeverity `json:"severity,omitempty"` + + /** Code defined: + * The diagnostic's code, which usually appear in the user interface. + */ + Code interface{} `json:"code,omitempty"` // number | string + + /** Source defined: + * A human-readable string describing the source of this + * diagnostic, e.g. 'typescript' or 'super lint'. It usually + * appears in the user interface. + */ + Source string `json:"source,omitempty"` + + /** Message defined: + * The diagnostic's message. It usually appears in the user interface + */ + Message string `json:"message"` + + /** Tags defined: + * Additional metadata about the diagnostic. + */ + Tags []DiagnosticTag `json:"tags,omitempty"` + + /** RelatedInformation defined: + * An array of related diagnostic information, e.g. when symbol-names within + * a scope collide all definitions can be marked via this property. + */ + RelatedInformation []DiagnosticRelatedInformation `json:"relatedInformation,omitempty"` +} + +// Command is: +/** + * Represents a reference to a command. Provides a title which + * will be used to represent a command in the UI and, optionally, + * an array of arguments which will be passed to the command handler + * function when invoked. + */ +type Command struct { + + /** Title defined: + * Title of the command, like `save`. + */ + Title string `json:"title"` + + /** Command defined: + * The identifier of the actual command handler. + */ + Command string `json:"command"` + + /** Arguments defined: + * Arguments that the command handler should be + * invoked with. + */ + Arguments []interface{} `json:"arguments,omitempty"` +} + +// TextEdit is: +/** + * A text edit applicable to a text document. + */ +type TextEdit struct { + + /** Range defined: + * The range of the text document to be manipulated. To insert + * text into a document create a range where start === end. + */ + Range Range `json:"range"` + + /** NewText defined: + * The string to be inserted. For delete operations use an + * empty string. + */ + NewText string `json:"newText"` +} + +// TextDocumentEdit is: +/** + * Describes textual changes on a text document. + */ +type TextDocumentEdit struct { + + /** TextDocument defined: + * The text document to change. + */ + TextDocument VersionedTextDocumentIdentifier `json:"textDocument"` + + /** Edits defined: + * The edits to be applied. + */ + Edits []TextEdit `json:"edits"` +} + +// ResourceOperation is: +type ResourceOperation struct { + + // Kind is + Kind string `json:"kind"` +} + +// CreateFileOptions is: +/** + * Options to create a file. + */ +type CreateFileOptions struct { + + /** Overwrite defined: + * Overwrite existing file. Overwrite wins over `ignoreIfExists` + */ + Overwrite bool `json:"overwrite,omitempty"` + + /** IgnoreIfExists defined: + * Ignore if exists. + */ + IgnoreIfExists bool `json:"ignoreIfExists,omitempty"` +} + +// CreateFile is: +/** + * Create file operation. + */ +type CreateFile struct { + ResourceOperation + + /** Kind defined: + * A create + */ + Kind string `json:"kind"` // 'create' + + /** URI defined: + * The resource to create. + */ + URI string `json:"uri"` + + /** Options defined: + * Additional options + */ + Options *CreateFileOptions `json:"options,omitempty"` +} + +// RenameFileOptions is: +/** + * Rename file options + */ +type RenameFileOptions struct { + + /** Overwrite defined: + * Overwrite target if existing. Overwrite wins over `ignoreIfExists` + */ + Overwrite bool `json:"overwrite,omitempty"` + + /** IgnoreIfExists defined: + * Ignores if target exists. + */ + IgnoreIfExists bool `json:"ignoreIfExists,omitempty"` +} + +// RenameFile is: +/** + * Rename file operation + */ +type RenameFile struct { + ResourceOperation + + /** Kind defined: + * A rename + */ + Kind string `json:"kind"` // 'rename' + + /** OldURI defined: + * The old (existing) location. + */ + OldURI string `json:"oldUri"` + + /** NewURI defined: + * The new location. + */ + NewURI string `json:"newUri"` + + /** Options defined: + * Rename options. + */ + Options *RenameFileOptions `json:"options,omitempty"` +} + +// DeleteFileOptions is: +/** + * Delete file options + */ +type DeleteFileOptions struct { + + /** Recursive defined: + * Delete the content recursively if a folder is denoted. + */ + Recursive bool `json:"recursive,omitempty"` + + /** IgnoreIfNotExists defined: + * Ignore the operation if the file doesn't exist. + */ + IgnoreIfNotExists bool `json:"ignoreIfNotExists,omitempty"` +} + +// DeleteFile is: +/** + * Delete file operation + */ +type DeleteFile struct { + ResourceOperation + + /** Kind defined: + * A delete + */ + Kind string `json:"kind"` // 'delete' + + /** URI defined: + * The file to delete. + */ + URI string `json:"uri"` + + /** Options defined: + * Delete options. + */ + Options *DeleteFileOptions `json:"options,omitempty"` +} + +// WorkspaceEdit is: +/** + * A workspace edit represents changes to many resources managed in the workspace. The edit + * should either provide `changes` or `documentChanges`. If documentChanges are present + * they are preferred over `changes` if the client can handle versioned document edits. + */ +type WorkspaceEdit struct { + + /** Changes defined: + * Holds changes to existing resources. + */ + Changes *map[string][]TextEdit `json:"changes,omitempty"` // [uri: string]: TextEdit[]; + + /** DocumentChanges defined: + * Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes + * are either an array of `TextDocumentEdit`s to express changes to n different text documents + * where each text document edit addresses a specific version of a text document. Or it can contain + * above `TextDocumentEdit`s mixed with create, rename and delete file / folder operations. + * + * Whether a client supports versioned document edits is expressed via + * `workspace.workspaceEdit.documentChanges` client capability. + * + * If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then + * only plain `TextEdit`s using the `changes` property are supported. + */ + DocumentChanges []TextDocumentEdit `json:"documentChanges,omitempty"` // (TextDocumentEdit | CreateFile | RenameFile | DeleteFile) +} + +// TextEditChange is: +/** + * A change to capture text edits for existing resources. + */ +type TextEditChange struct { +} + +// TextDocumentIdentifier is: +/** + * A literal to identify a text document in the client. + */ +type TextDocumentIdentifier struct { + + /** URI defined: + * The text document's uri. + */ + URI string `json:"uri"` +} + +// VersionedTextDocumentIdentifier is: +/** + * An identifier to denote a specific version of a text document. + */ +type VersionedTextDocumentIdentifier struct { + TextDocumentIdentifier + + /** Version defined: + * The version number of this document. If a versioned text document identifier + * is sent from the server to the client and the file is not open in the editor + * (the server has not received an open notification before) the server can send + * `null` to indicate that the version is unknown and the content on disk is the + * truth (as speced with document content ownership). + */ + Version float64 `json:"version"` +} + +// TextDocumentItem is: +/** + * An item to transfer a text document from the client to the + * server. + */ +type TextDocumentItem struct { + + /** URI defined: + * The text document's uri. + */ + URI string `json:"uri"` + + /** LanguageID defined: + * The text document's language identifier + */ + LanguageID string `json:"languageId"` + + /** Version defined: + * The version number of this document (it will increase after each + * change, including undo/redo). + */ + Version float64 `json:"version"` + + /** Text defined: + * The content of the opened text document. + */ + Text string `json:"text"` +} + +// MarkupContent is: +/** + * A `MarkupContent` literal represents a string value which content is interpreted base on its + * kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds. + * + * If the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues. + * See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting + * + * Here is an example how such a string can be constructed using JavaScript / TypeScript: + * ```ts + * let markdown: MarkdownContent = { + * kind: MarkupKind.Markdown, + * value: [ + * '# Header', + * 'Some text', + * '```typescript', + * 'someCode();', + * '```' + * ].join('\n') + * }; + * ``` + * + * *Please Note* that clients might sanitize the return markdown. A client could decide to + * remove HTML from the markdown to avoid script execution. + */ +type MarkupContent struct { + + /** Kind defined: + * The type of the Markup + */ + Kind MarkupKind `json:"kind"` + + /** Value defined: + * The content itself + */ + Value string `json:"value"` +} + +// CompletionItem is: +/** + * A completion item represents a text snippet that is + * proposed to complete text that is being typed. + */ +type CompletionItem struct { + + /** Label defined: + * The label of this completion item. By default + * also the text that is inserted when selecting + * this completion. + */ + Label string `json:"label"` + + /** Kind defined: + * The kind of this completion item. Based of the kind + * an icon is chosen by the editor. + */ + Kind CompletionItemKind `json:"kind,omitempty"` + + /** Detail defined: + * A human-readable string with additional information + * about this item, like type or symbol information. + */ + Detail string `json:"detail,omitempty"` + + /** Documentation defined: + * A human-readable string that represents a doc-comment. + */ + Documentation string `json:"documentation,omitempty"` // string | MarkupContent + + /** Deprecated defined: + * Indicates if this item is deprecated. + */ + Deprecated bool `json:"deprecated,omitempty"` + + /** Preselect defined: + * Select this item when showing. + * + * *Note* that only one completion item can be selected and that the + * tool / client decides which item that is. The rule is that the *first* + * item of those that match best is selected. + */ + Preselect bool `json:"preselect,omitempty"` + + /** SortText defined: + * A string that should be used when comparing this item + * with other items. When `falsy` the [label](#CompletionItem.label) + * is used. + */ + SortText string `json:"sortText,omitempty"` + + /** FilterText defined: + * A string that should be used when filtering a set of + * completion items. When `falsy` the [label](#CompletionItem.label) + * is used. + */ + FilterText string `json:"filterText,omitempty"` + + /** InsertText defined: + * A string that should be inserted into a document when selecting + * this completion. When `falsy` the [label](#CompletionItem.label) + * is used. + * + * The `insertText` is subject to interpretation by the client side. + * Some tools might not take the string literally. For example + * VS Code when code complete is requested in this example `con` + * and a completion item with an `insertText` of `console` is provided it + * will only insert `sole`. Therefore it is recommended to use `textEdit` instead + * since it avoids additional client side interpretation. + * + * @deprecated Use textEdit instead. + */ + InsertText string `json:"insertText,omitempty"` + + /** InsertTextFormat defined: + * The format of the insert text. The format applies to both the `insertText` property + * and the `newText` property of a provided `textEdit`. + */ + InsertTextFormat InsertTextFormat `json:"insertTextFormat,omitempty"` + + /** TextEdit defined: + * An [edit](#TextEdit) which is applied to a document when selecting + * this completion. When an edit is provided the value of + * [insertText](#CompletionItem.insertText) is ignored. + * + * *Note:* The text edit's range must be a [single line] and it must contain the position + * at which completion has been requested. + */ + TextEdit *TextEdit `json:"textEdit,omitempty"` + + /** AdditionalTextEdits defined: + * An optional array of additional [text edits](#TextEdit) that are applied when + * selecting this completion. Edits must not overlap (including the same insert position) + * with the main [edit](#CompletionItem.textEdit) nor with themselves. + * + * Additional text edits should be used to change text unrelated to the current cursor position + * (for example adding an import statement at the top of the file if the completion item will + * insert an unqualified type). + */ + AdditionalTextEdits []TextEdit `json:"additionalTextEdits,omitempty"` + + /** CommitCharacters defined: + * An optional set of characters that when pressed while this completion is active will accept it first and + * then type that character. *Note* that all commit characters should have `length=1` and that superfluous + * characters will be ignored. + */ + CommitCharacters []string `json:"commitCharacters,omitempty"` + + /** Command defined: + * An optional [command](#Command) that is executed *after* inserting this completion. *Note* that + * additional modifications to the current document should be described with the + * [additionalTextEdits](#CompletionItem.additionalTextEdits)-property. + */ + Command *Command `json:"command,omitempty"` + + /** Data defined: + * An data entry field that is preserved on a completion item between + * a [CompletionRequest](#CompletionRequest) and a [CompletionResolveRequest] + * (#CompletionResolveRequest) + */ + Data interface{} `json:"data,omitempty"` +} + +// CompletionList is: +/** + * Represents a collection of [completion items](#CompletionItem) to be presented + * in the editor. + */ +type CompletionList struct { + + /** IsIncomplete defined: + * This list it not complete. Further typing results in recomputing this list. + */ + IsIncomplete bool `json:"isIncomplete"` + + /** Items defined: + * The completion items. + */ + Items []CompletionItem `json:"items"` +} + +// Hover is: +/** + * The result of a hover request. + */ +type Hover struct { + + /** Contents defined: + * The hover's content + */ + Contents MarkupContent `json:"contents"` // MarkupContent | MarkedString | MarkedString[] + + /** Range defined: + * An optional range + */ + Range *Range `json:"range,omitempty"` +} + +// ParameterInformation is: +/** + * Represents a parameter of a callable-signature. A parameter can + * have a label and a doc-comment. + */ +type ParameterInformation struct { + + /** Label defined: + * The label of this parameter information. + * + * Either a string or an inclusive start and exclusive end offsets within its containing + * signature label. (see SignatureInformation.label). The offsets are based on a UTF-16 + * string representation as `Position` and `Range` does. + * + * *Note*: a label of type string should be a substring of its containing signature label. + * Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`. + */ + Label string `json:"label"` // string | [number, number] + + /** Documentation defined: + * The human-readable doc-comment of this signature. Will be shown + * in the UI but can be omitted. + */ + Documentation string `json:"documentation,omitempty"` // string | MarkupContent +} + +// SignatureInformation is: +/** + * Represents the signature of something callable. A signature + * can have a label, like a function-name, a doc-comment, and + * a set of parameters. + */ +type SignatureInformation struct { + + /** Label defined: + * The label of this signature. Will be shown in + * the UI. + */ + Label string `json:"label"` + + /** Documentation defined: + * The human-readable doc-comment of this signature. Will be shown + * in the UI but can be omitted. + */ + Documentation string `json:"documentation,omitempty"` // string | MarkupContent + + /** Parameters defined: + * The parameters of this signature. + */ + Parameters []ParameterInformation `json:"parameters,omitempty"` +} + +// SignatureHelp is: +/** + * Signature help represents the signature of something + * callable. There can be multiple signature but only one + * active and only one active parameter. + */ +type SignatureHelp struct { + + /** Signatures defined: + * One or more signatures. + */ + Signatures []SignatureInformation `json:"signatures"` + + /** ActiveSignature defined: + * The active signature. Set to `null` if no + * signatures exist. + */ + ActiveSignature float64 `json:"activeSignature"` + + /** ActiveParameter defined: + * The active parameter of the active signature. Set to `null` + * if the active signature has no parameters. + */ + ActiveParameter float64 `json:"activeParameter"` +} + +// ReferenceContext is: +/** + * Value-object that contains additional information when + * requesting references. + */ +type ReferenceContext struct { + + /** IncludeDeclaration defined: + * Include the declaration of the current symbol. + */ + IncludeDeclaration bool `json:"includeDeclaration"` +} + +// DocumentHighlight is: +/** + * A document highlight is a range inside a text document which deserves + * special attention. Usually a document highlight is visualized by changing + * the background color of its range. + */ +type DocumentHighlight struct { + + /** Range defined: + * The range this highlight applies to. + */ + Range Range `json:"range"` + + /** Kind defined: + * The highlight kind, default is [text](#DocumentHighlightKind.Text). + */ + Kind *DocumentHighlightKind `json:"kind,omitempty"` +} + +// SymbolInformation is: +/** + * Represents information about programming constructs like variables, classes, + * interfaces etc. + */ +type SymbolInformation struct { + + /** Name defined: + * The name of this symbol. + */ + Name string `json:"name"` + + /** Kind defined: + * The kind of this symbol. + */ + Kind SymbolKind `json:"kind"` + + /** Deprecated defined: + * Indicates if this symbol is deprecated. + */ + Deprecated bool `json:"deprecated,omitempty"` + + /** Location defined: + * The location of this symbol. The location's range is used by a tool + * to reveal the location in the editor. If the symbol is selected in the + * tool the range's start information is used to position the cursor. So + * the range usually spans more than the actual symbol's name and does + * normally include thinks like visibility modifiers. + * + * The range doesn't have to denote a node range in the sense of a abstract + * syntax tree. It can therefore not be used to re-construct a hierarchy of + * the symbols. + */ + Location Location `json:"location"` + + /** ContainerName defined: + * The name of the symbol containing this symbol. This information is for + * user interface purposes (e.g. to render a qualifier in the user interface + * if necessary). It can't be used to re-infer a hierarchy for the document + * symbols. + */ + ContainerName string `json:"containerName,omitempty"` +} + +// DocumentSymbol is: +/** + * Represents programming constructs like variables, classes, interfaces etc. + * that appear in a document. Document symbols can be hierarchical and they + * have two ranges: one that encloses its definition and one that points to + * its most interesting range, e.g. the range of an identifier. + */ +type DocumentSymbol struct { + + /** Name defined: + * The name of this symbol. Will be displayed in the user interface and therefore must not be + * an empty string or a string only consisting of white spaces. + */ + Name string `json:"name"` + + /** Detail defined: + * More detail for this symbol, e.g the signature of a function. + */ + Detail string `json:"detail,omitempty"` + + /** Kind defined: + * The kind of this symbol. + */ + Kind SymbolKind `json:"kind"` + + /** Deprecated defined: + * Indicates if this symbol is deprecated. + */ + Deprecated bool `json:"deprecated,omitempty"` + + /** Range defined: + * The range enclosing this symbol not including leading/trailing whitespace but everything else + * like comments. This information is typically used to determine if the the clients cursor is + * inside the symbol to reveal in the symbol in the UI. + */ + Range Range `json:"range"` + + /** SelectionRange defined: + * The range that should be selected and revealed when this symbol is being picked, e.g the name of a function. + * Must be contained by the the `range`. + */ + SelectionRange Range `json:"selectionRange"` + + /** Children defined: + * Children of this symbol, e.g. properties of a class. + */ + Children []DocumentSymbol `json:"children,omitempty"` +} + +// DocumentSymbolParams is: +/** + * Parameters for a [DocumentSymbolRequest](#DocumentSymbolRequest). + */ +type DocumentSymbolParams struct { + + /** TextDocument defined: + * The text document. + */ + TextDocument TextDocumentIdentifier `json:"textDocument"` +} + +// WorkspaceSymbolParams is: +/** + * The parameters of a [WorkspaceSymbolRequest](#WorkspaceSymbolRequest). + */ +type WorkspaceSymbolParams struct { + + /** Query defined: + * A non-empty query string + */ + Query string `json:"query"` +} + +// CodeActionContext is: +/** + * Contains additional diagnostic information about the context in which + * a [code action](#CodeActionProvider.provideCodeActions) is run. + */ +type CodeActionContext struct { + + /** Diagnostics defined: + * An array of diagnostics known on the client side overlapping the range provided to the + * `textDocument/codeAction` request. They are provied so that the server knows which + * errors are currently presented to the user for the given range. There is no guarantee + * that these accurately reflect the error state of the resource. The primary parameter + * to compute code actions is the provided range. + */ + Diagnostics []Diagnostic `json:"diagnostics"` + + /** Only defined: + * Requested kind of actions to return. + * + * Actions not of this kind are filtered out by the client before being shown. So servers + * can omit computing them. + */ + Only []CodeActionKind `json:"only,omitempty"` +} + +// CodeAction is: +/** + * A code action represents a change that can be performed in code, e.g. to fix a problem or + * to refactor code. + * + * A CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed. + */ +type CodeAction struct { + + /** Title defined: + * A short, human-readable, title for this code action. + */ + Title string `json:"title"` + + /** Kind defined: + * The kind of the code action. + * + * Used to filter code actions. + */ + Kind CodeActionKind `json:"kind,omitempty"` + + /** Diagnostics defined: + * The diagnostics that this code action resolves. + */ + Diagnostics []Diagnostic `json:"diagnostics,omitempty"` + + /** Edit defined: + * The workspace edit this code action performs. + */ + Edit *WorkspaceEdit `json:"edit,omitempty"` + + /** Command defined: + * A command this code action executes. If a code action + * provides a edit and a command, first the edit is + * executed and then the command. + */ + Command *Command `json:"command,omitempty"` +} + +// CodeLens is: +/** + * A code lens represents a [command](#Command) that should be shown along with + * source text, like the number of references, a way to run tests, etc. + * + * A code lens is _unresolved_ when no command is associated to it. For performance + * reasons the creation of a code lens and resolving should be done to two stages. + */ +type CodeLens struct { + + /** Range defined: + * The range in which this code lens is valid. Should only span a single line. + */ + Range Range `json:"range"` + + /** Command defined: + * The command this code lens represents. + */ + Command *Command `json:"command,omitempty"` + + /** Data defined: + * An data entry field that is preserved on a code lens item between + * a [CodeLensRequest](#CodeLensRequest) and a [CodeLensResolveRequest] + * (#CodeLensResolveRequest) + */ + Data interface{} `json:"data,omitempty"` +} + +// FormattingOptions is: +/** + * Value-object describing what options formatting should use. + */ +type FormattingOptions struct { + + /** TabSize defined: + * Size of a tab in spaces. + */ + TabSize float64 `json:"tabSize"` + + /** InsertSpaces defined: + * Prefer spaces over tabs. + */ + InsertSpaces bool `json:"insertSpaces"` + + /** TrimTrailingWhitespace defined: + * Trim trailing whitespaces on a line. + */ + TrimTrailingWhitespace bool `json:"trimTrailingWhitespace,omitempty"` + + /** InsertFinalNewline defined: + * Insert a newline character at the end of the file if one does not exist. + */ + InsertFinalNewline bool `json:"insertFinalNewline,omitempty"` + + /** TrimFinalNewlines defined: + * Trim all newlines after the final newline at the end of the file. + */ + TrimFinalNewlines bool `json:"trimFinalNewlines,omitempty"` + + /** Key defined: + * Signature for further properties. + */ + Key map[string]bool `json:"key"` // [key: string]: boolean | number | string | undefined; +} + +// DocumentLink is: +/** + * A document link is a range in a text document that links to an internal or external resource, like another + * text document or a web site. + */ +type DocumentLink struct { + + /** Range defined: + * The range this link applies to. + */ + Range Range `json:"range"` + + /** Target defined: + * The uri this link points to. + */ + Target string `json:"target,omitempty"` + + /** Data defined: + * A data entry field that is preserved on a document link between a + * DocumentLinkRequest and a DocumentLinkResolveRequest. + */ + Data interface{} `json:"data,omitempty"` +} + +// TextDocument is: +/** + * A simple text document. Not to be implemented. + */ +type TextDocument struct { + + /** URI defined: + * The associated URI for this document. Most documents have the __file__-scheme, indicating that they + * represent files on disk. However, some documents may have other schemes indicating that they are not + * available on disk. + * + * @readonly + */ + URI string `json:"uri"` + + /** LanguageID defined: + * The identifier of the language associated with this document. + * + * @readonly + */ + LanguageID string `json:"languageId"` + + /** Version defined: + * The version number of this document (it will increase after each + * change, including undo/redo). + * + * @readonly + */ + Version float64 `json:"version"` + + /** LineCount defined: + * The number of lines in this document. + * + * @readonly + */ + LineCount float64 `json:"lineCount"` +} + +// TextDocumentChangeEvent is: +/** + * Event to signal changes to a simple text document. + */ +type TextDocumentChangeEvent struct { + + /** Document defined: + * The document that has changed. + */ + Document TextDocument `json:"document"` +} + +// TextDocumentWillSaveEvent is: +type TextDocumentWillSaveEvent struct { + + /** Document defined: + * The document that will be saved + */ + Document TextDocument `json:"document"` + + /** Reason defined: + * The reason why save was triggered. + */ + Reason TextDocumentSaveReason `json:"reason"` +} + +// TextDocumentContentChangeEvent is: +/** + * An event describing a change to a text document. If range and rangeLength are omitted + * the new text is considered to be the full content of the document. + */ +type TextDocumentContentChangeEvent struct { + + /** Range defined: + * The range of the document that changed. + */ + Range *Range `json:"range,omitempty"` + + /** RangeLength defined: + * The length of the range that got replaced. + */ + RangeLength float64 `json:"rangeLength,omitempty"` + + /** Text defined: + * The new text of the document. + */ + Text string `json:"text"` +} + +// FoldingRangeKind defines constants +type FoldingRangeKind string + +// SelectionRangeKind defines constants +type SelectionRangeKind string + +// ResourceOperationKind defines constants +type ResourceOperationKind string + +// FailureHandlingKind defines constants +type FailureHandlingKind string + +// TextDocumentSyncKind defines constants +type TextDocumentSyncKind float64 + +// InitializeError defines constants +type InitializeError float64 + +// MessageType defines constants +type MessageType float64 + +// FileChangeType defines constants +type FileChangeType float64 + +// WatchKind defines constants +type WatchKind float64 + +// CompletionTriggerKind defines constants +type CompletionTriggerKind float64 + +// DiagnosticSeverity defines constants +type DiagnosticSeverity float64 + +// DiagnosticTag defines constants +type DiagnosticTag float64 + +// MarkupKind defines constants +type MarkupKind string + +// CompletionItemKind defines constants +type CompletionItemKind float64 + +// InsertTextFormat defines constants +type InsertTextFormat float64 + +// DocumentHighlightKind defines constants +type DocumentHighlightKind float64 + +// SymbolKind defines constants +type SymbolKind float64 + +// CodeActionKind defines constants +type CodeActionKind string + +// TextDocumentSaveReason defines constants +type TextDocumentSaveReason float64 + +const ( + + // Comment is: + /** + * Folding range for a comment + */ + Comment FoldingRangeKind = "comment" + + // Imports is: + /** + * Folding range for a imports or includes + */ + Imports FoldingRangeKind = "imports" + + // Region is: + /** + * Folding range for a region (e.g. `#region`) + */ + Region FoldingRangeKind = "region" + + // Empty is: + /** + * Empty Kind. + */ + Empty SelectionRangeKind = "" + + // Statement is: + /** + * The statment kind, its value is `statement`, possible extensions can be + * `statement.if` etc + */ + Statement SelectionRangeKind = "statement" + + // Declaration is: + /** + * The declaration kind, its value is `declaration`, possible extensions can be + * `declaration.function`, `declaration.class` etc. + */ + Declaration SelectionRangeKind = "declaration" + + // Create is: + /** + * Supports creating new files and folders. + */ + Create ResourceOperationKind = "create" + + // Rename is: + /** + * Supports renaming existing files and folders. + */ + Rename ResourceOperationKind = "rename" + + // Delete is: + /** + * Supports deleting existing files and folders. + */ + Delete ResourceOperationKind = "delete" + + // Abort is: + /** + * Applying the workspace change is simply aborted if one of the changes provided + * fails. All operations executed before the failing operation stay executed. + */ + Abort FailureHandlingKind = "abort" + + // Transactional is: + /** + * All operations are executed transactional. That means they either all + * succeed or no changes at all are applied to the workspace. + */ + Transactional FailureHandlingKind = "transactional" + + // TextOnlyTransactional is: + /** + * If the workspace edit contains only textual file changes they are executed transactional. + * If resource changes (create, rename or delete file) are part of the change the failure + * handling startegy is abort. + */ + TextOnlyTransactional FailureHandlingKind = "textOnlyTransactional" + + // Undo is: + /** + * The client tries to undo the operations already executed. But there is no + * guaruntee that this is succeeding. + */ + Undo FailureHandlingKind = "undo" + + // None is: + /** + * Documents should not be synced at all. + */ + None TextDocumentSyncKind = 0 + + // Full is: + /** + * Documents are synced by always sending the full content + * of the document. + */ + Full TextDocumentSyncKind = 1 + + // Incremental is: + /** + * Documents are synced by sending the full content on open. + * After that only incremental updates to the document are + * send. + */ + Incremental TextDocumentSyncKind = 2 + + // UnknownProtocolVersion is: + /** + * If the protocol version provided by the client can't be handled by the server. + * @deprecated This initialize error got replaced by client capabilities. There is + * no version handshake in version 3.0x + */ + UnknownProtocolVersion InitializeError = 1 + + // Error is: + /** + * An error message. + */ + Error MessageType = 1 + + // Warning is: + /** + * A warning message. + */ + Warning MessageType = 2 + + // Info is: + /** + * An information message. + */ + Info MessageType = 3 + + // Log is: + /** + * A log message. + */ + Log MessageType = 4 + + // Created is: + /** + * The file got created. + */ + Created FileChangeType = 1 + + // Changed is: + /** + * The file got changed. + */ + Changed FileChangeType = 2 + + // Deleted is: + /** + * The file got deleted. + */ + Deleted FileChangeType = 3 + + // Change is: + /** + * Interested in change events + */ + Change WatchKind = 2 + + // Invoked is: + /** + * Completion was triggered by typing an identifier (24x7 code + * complete), manual invocation (e.g Ctrl+Space) or via API. + */ + Invoked CompletionTriggerKind = 1 + + // TriggerCharacter is: + /** + * Completion was triggered by a trigger character specified by + * the `triggerCharacters` properties of the `CompletionRegistrationOptions`. + */ + TriggerCharacter CompletionTriggerKind = 2 + + // TriggerForIncompleteCompletions is: + /** + * Completion was re-triggered as current completion list is incomplete + */ + TriggerForIncompleteCompletions CompletionTriggerKind = 3 + + // SeverityError is: + /** + * Reports an error. + */ + SeverityError DiagnosticSeverity = 1 + + // SeverityWarning is: + /** + * Reports a warning. + */ + SeverityWarning DiagnosticSeverity = 2 + + // SeverityInformation is: + /** + * Reports an information. + */ + SeverityInformation DiagnosticSeverity = 3 + + // SeverityHint is: + /** + * Reports a hint. + */ + SeverityHint DiagnosticSeverity = 4 + + // Unnecessary is: + /** + * Unused or unnecessary code. + * + * Clients are allowed to render diagnostics with this tag faded out instead of having + * an error squiggle. + */ + Unnecessary DiagnosticTag = 1 + + // PlainText is: + /** + * Plain text is supported as a content format + */ + PlainText MarkupKind = "plaintext" + + // Markdown is: + /** + * Markdown is supported as a content format + */ + Markdown MarkupKind = "markdown" + + // TextCompletion is: + TextCompletion CompletionItemKind = 1 + + // MethodCompletion is: + MethodCompletion CompletionItemKind = 2 + + // FunctionCompletion is: + FunctionCompletion CompletionItemKind = 3 + + // ConstructorCompletion is: + ConstructorCompletion CompletionItemKind = 4 + + // FieldCompletion is: + FieldCompletion CompletionItemKind = 5 + + // VariableCompletion is: + VariableCompletion CompletionItemKind = 6 + + // ClassCompletion is: + ClassCompletion CompletionItemKind = 7 + + // InterfaceCompletion is: + InterfaceCompletion CompletionItemKind = 8 + + // ModuleCompletion is: + ModuleCompletion CompletionItemKind = 9 + + // PropertyCompletion is: + PropertyCompletion CompletionItemKind = 10 + + // UnitCompletion is: + UnitCompletion CompletionItemKind = 11 + + // ValueCompletion is: + ValueCompletion CompletionItemKind = 12 + + // EnumCompletion is: + EnumCompletion CompletionItemKind = 13 + + // KeywordCompletion is: + KeywordCompletion CompletionItemKind = 14 + + // SnippetCompletion is: + SnippetCompletion CompletionItemKind = 15 + + // ColorCompletion is: + ColorCompletion CompletionItemKind = 16 + + // FileCompletion is: + FileCompletion CompletionItemKind = 17 + + // ReferenceCompletion is: + ReferenceCompletion CompletionItemKind = 18 + + // FolderCompletion is: + FolderCompletion CompletionItemKind = 19 + + // EnumMemberCompletion is: + EnumMemberCompletion CompletionItemKind = 20 + + // ConstantCompletion is: + ConstantCompletion CompletionItemKind = 21 + + // StructCompletion is: + StructCompletion CompletionItemKind = 22 + + // EventCompletion is: + EventCompletion CompletionItemKind = 23 + + // OperatorCompletion is: + OperatorCompletion CompletionItemKind = 24 + + // TypeParameterCompletion is: + TypeParameterCompletion CompletionItemKind = 25 + + // PlainTextTextFormat is: + /** + * The primary text to be inserted is treated as a plain string. + */ + PlainTextTextFormat InsertTextFormat = 1 + + // SnippetTextFormat is: + /** + * The primary text to be inserted is treated as a snippet. + * + * A snippet can define tab stops and placeholders with `$1`, `$2` + * and `${3:foo}`. `$0` defines the final tab stop, it defaults to + * the end of the snippet. Placeholders with equal identifiers are linked, + * that is typing in one will update others too. + * + * See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md + */ + SnippetTextFormat InsertTextFormat = 2 + + // Text is: + /** + * A textual occurrence. + */ + Text DocumentHighlightKind = 1 + + // Read is: + /** + * Read-access of a symbol, like reading a variable. + */ + Read DocumentHighlightKind = 2 + + // Write is: + /** + * Write-access of a symbol, like writing to a variable. + */ + Write DocumentHighlightKind = 3 + + // File is: + File SymbolKind = 1 + + // Module is: + Module SymbolKind = 2 + + // Namespace is: + Namespace SymbolKind = 3 + + // Package is: + Package SymbolKind = 4 + + // Class is: + Class SymbolKind = 5 + + // Method is: + Method SymbolKind = 6 + + // Property is: + Property SymbolKind = 7 + + // Field is: + Field SymbolKind = 8 + + // Constructor is: + Constructor SymbolKind = 9 + + // Enum is: + Enum SymbolKind = 10 + + // Interface is: + Interface SymbolKind = 11 + + // Function is: + Function SymbolKind = 12 + + // Variable is: + Variable SymbolKind = 13 + + // Constant is: + Constant SymbolKind = 14 + + // String is: + String SymbolKind = 15 + + // Number is: + Number SymbolKind = 16 + + // Boolean is: + Boolean SymbolKind = 17 + + // Array is: + Array SymbolKind = 18 + + // Object is: + Object SymbolKind = 19 + + // Key is: + Key SymbolKind = 20 + + // Null is: + Null SymbolKind = 21 + + // EnumMember is: + EnumMember SymbolKind = 22 + + // Struct is: + Struct SymbolKind = 23 + + // Event is: + Event SymbolKind = 24 + + // Operator is: + Operator SymbolKind = 25 + + // TypeParameter is: + TypeParameter SymbolKind = 26 + + // QuickFix is: + /** + * Base kind for quickfix actions: 'quickfix' + */ + QuickFix CodeActionKind = "quickfix" + + // Refactor is: + /** + * Base kind for refactoring actions: 'refactor' + */ + Refactor CodeActionKind = "refactor" + + // RefactorExtract is: + /** + * Base kind for refactoring extraction actions: 'refactor.extract' + * + * Example extract actions: + * + * - Extract method + * - Extract function + * - Extract variable + * - Extract interface from class + * - ... + */ + RefactorExtract CodeActionKind = "refactor.extract" + + // RefactorInline is: + /** + * Base kind for refactoring inline actions: 'refactor.inline' + * + * Example inline actions: + * + * - Inline function + * - Inline variable + * - Inline constant + * - ... + */ + RefactorInline CodeActionKind = "refactor.inline" + + // RefactorRewrite is: + /** + * Base kind for refactoring rewrite actions: 'refactor.rewrite' + * + * Example rewrite actions: + * + * - Convert JavaScript function to class + * - Add or remove parameter + * - Encapsulate field + * - Make method static + * - Move method to base class + * - ... + */ + RefactorRewrite CodeActionKind = "refactor.rewrite" + + // Source is: + /** + * Base kind for source actions: `source` + * + * Source code actions apply to the entire file. + */ + Source CodeActionKind = "source" + + // SourceOrganizeImports is: + /** + * Base kind for an organize imports source action: `source.organizeImports` + */ + SourceOrganizeImports CodeActionKind = "source.organizeImports" + + // Manual is: + /** + * Manually triggered, e.g. by the user pressing save, by starting debugging, + * or by an API call. + */ + Manual TextDocumentSaveReason = 1 + + // AfterDelay is: + /** + * Automatic after a delay. + */ + AfterDelay TextDocumentSaveReason = 2 + + // FocusOut is: + /** + * When the editor lost focus. + */ + FocusOut TextDocumentSaveReason = 3 +) + +// DocumentFilter is a type +/** + * 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 conditions (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' }` + */ +type DocumentFilter struct { + + /** Language defined: A language id, like `typescript`. */ + Language string `json:"language,omitempty"` + + /** Scheme defined: A Uri [scheme](#Uri.scheme), like `file` or `untitled`. */ + Scheme string `json:"scheme,omitempty"` + + /** Pattern defined: A glob pattern, like `*.{ts,js}`. */ + Pattern string `json:"pattern,omitempty"` +} + +// DocumentSelector is a type +/** + * A document selector is the combination of one or many document filters. + * + * @sample `let sel:DocumentSelector = [{ language: 'typescript' }, { language: 'json', pattern: '**∕tsconfig.json' }]`; + */ +type DocumentSelector []DocumentFilter + +// DefinitionLink is a type +/** + * Information about where a symbol is defined. + * + * Provides additional metadata over normal [location](#Location) definitions, including the range of + * the defining symbol + */ +type DefinitionLink LocationLink + +// DeclarationLink is a type +/** + * Information about where a symbol is declared. + * + * Provides additional metadata over normal [location](#Location) declarations, including the range of + * the declaring symbol. + * + * Servers should prefer returning `DeclarationLink` over `Declaration` if supported + * by the client. + */ +type DeclarationLink LocationLink diff --git a/internal/lsp/server.go b/internal/lsp/server.go index 99f0fd67ac..f9a223466e 100644 --- a/internal/lsp/server.go +++ b/internal/lsp/server.go @@ -84,12 +84,15 @@ func (s *server) Initialize(ctx context.Context, params *protocol.InitializePara s.initialized = true // mark server as initialized now // Check if the client supports snippets in completion items. - s.snippetsSupported = params.Capabilities.TextDocument.Completion.CompletionItem.SnippetSupport + capText := params.Capabilities.InnerClientCapabilities.TextDocument + if capText != nil && capText.Completion != nil && capText.Completion.CompletionItem != nil { + s.snippetsSupported = capText.Completion.CompletionItem.SnippetSupport + } s.signatureHelpEnabled = true - var rootURI protocol.DocumentURI - if params.RootURI != nil { - rootURI = *params.RootURI + var rootURI string + if params.RootURI != "" { + rootURI = params.RootURI } sourceURI, err := fromProtocolURI(rootURI) if err != nil { @@ -118,22 +121,26 @@ func (s *server) Initialize(ctx context.Context, params *protocol.InitializePara return &protocol.InitializeResult{ Capabilities: protocol.ServerCapabilities{ - CodeActionProvider: true, - CompletionProvider: protocol.CompletionOptions{ - TriggerCharacters: []string{"."}, + InnerServerCapabilities: protocol.InnerServerCapabilities{ + CodeActionProvider: true, + CompletionProvider: &protocol.CompletionOptions{ + TriggerCharacters: []string{"."}, + }, + DefinitionProvider: true, + DocumentFormattingProvider: true, + DocumentRangeFormattingProvider: true, + HoverProvider: true, + SignatureHelpProvider: &protocol.SignatureHelpOptions{ + TriggerCharacters: []string{"(", ","}, + }, + TextDocumentSync: &protocol.TextDocumentSyncOptions{ + Change: s.textDocumentSyncKind, + OpenClose: true, + }, }, - DefinitionProvider: true, - DocumentFormattingProvider: true, - DocumentRangeFormattingProvider: true, - HoverProvider: true, - SignatureHelpProvider: protocol.SignatureHelpOptions{ - TriggerCharacters: []string{"(", ","}, + TypeDefinitionServerCapabilities: protocol.TypeDefinitionServerCapabilities{ + TypeDefinitionProvider: true, }, - TextDocumentSync: protocol.TextDocumentSyncOptions{ - Change: float64(s.textDocumentSyncKind), - OpenClose: true, - }, - TypeDefinitionProvider: true, }, }, nil } @@ -345,12 +352,13 @@ func (s *server) Hover(ctx context.Context, params *protocol.TextDocumentPositio return nil, err } markdown := "```go\n" + content + "\n```" + x := toProtocolRange(tok, ident.Range) return &protocol.Hover{ Contents: protocol.MarkupContent{ Kind: protocol.Markdown, Value: markdown, }, - Range: toProtocolRange(tok, ident.Range), + Range: &x, }, nil } @@ -433,8 +441,8 @@ func (s *server) CodeAction(ctx context.Context, params *protocol.CodeActionPara { Title: "Organize Imports", Kind: protocol.SourceOrganizeImports, - Edit: protocol.WorkspaceEdit{ - Changes: map[protocol.DocumentURI][]protocol.TextEdit{ + Edit: &protocol.WorkspaceEdit{ + Changes: &map[string][]protocol.TextEdit{ params.TextDocument.URI: edits, }, }, @@ -482,7 +490,7 @@ func (s *server) Rename(context.Context, *protocol.RenameParams) ([]protocol.Wor return nil, notImplemented("Rename") } -func (s *server) FoldingRanges(context.Context, *protocol.FoldingRangeRequestParam) ([]protocol.FoldingRange, error) { +func (s *server) FoldingRanges(context.Context, *protocol.FoldingRangeParams) ([]protocol.FoldingRange, error) { return nil, notImplemented("FoldingRanges") }