Documentation
¶
Overview ¶
Package protocol 协议内容的定义
Index ¶
- Constants
- type CancelParams
- type ClientCapabilities
- type CodeActionKind
- type CodeActionOptions
- type CodeLensOptions
- type ColorProviderOptions
- type CompletionItemKind
- type CompletionOptions
- type DeclarationOptions
- type DeclarationRegistrationOptions
- type DefinitionOptions
- type Diagnostic
- type DiagnosticRelatedInformation
- type DiagnosticSeverity
- type DiagnosticTag
- type DidChangeConfigurationClientCapabilities
- type DidChangeTextDocumentParams
- type DidChangeWorkspaceFoldersParams
- type DidOpenTextDocumentParams
- type DidSaveTextDocumentParams
- type DocumentColorOptions
- type DocumentColorRegistrationOptions
- type DocumentFilter
- type DocumentFormattingOptions
- type DocumentHighlightOptions
- type DocumentLinkOptions
- type DocumentOnTypeFormattingOptions
- type DocumentRangeFormattingOptions
- type DocumentSelector
- type DocumentSymbolOptions
- type ExecuteCommandClientCapabilities
- type ExecuteCommandOptions
- type FailureHandlingKind
- type FoldingRangeOptions
- type FoldingRangeProviderOptions
- type FoldingRangeRegistrationOptions
- type Hover
- type HoverOptions
- type HoverParams
- type ImplementationOptions
- type ImplementationRegistrationOptions
- type InitializationOptions
- type InitializeParams
- type InitializeResult
- type InitializedParams
- type LogMessageParams
- type MarkupContent
- type MarkupKind
- type MessageActionItem
- type MessageType
- type ProgressToken
- type PublishDiagnosticsParams
- type ReferenceOptions
- type RenameOptions
- type ResourceOperationKind
- type SaveOptions
- type SelectionRangeOptions
- type SelectionRangeRegistrationOptions
- type ServerCapabilities
- type ServerCapabilitiesTextDocumentSyncOptions
- type ServerInfo
- type ShowMessageParams
- type ShowMessageRequestParams
- type SignatureHelpOptions
- type StaticRegistrationOptions
- type SymbolKind
- type TextDocumentClientCapabilities
- type TextDocumentContentChangeEvent
- type TextDocumentIdentifier
- type TextDocumentItem
- type TextDocumentPositionParams
- type TextDocumentRegistrationOptions
- type TextDocumentSyncKind
- type TextDocumentSyncOptions
- type TypeDefinitionOptions
- type TypeDefinitionRegistrationOptions
- type VersionedTextDocumentIdentifier
- type WorkDoneProgressOptions
- type WorkDoneProgressParams
- type WorkspaceEditClientCapabilities
- type WorkspaceFolder
- type WorkspaceFoldersChangeEvent
- type WorkspaceFoldersServerCapabilities
- type WorkspaceSymbolClientCapabilities
Constants ¶
const ( InitializeTraceOff = "off" InitializeTraceMessages = "messages" InitializeTraceVerbose = "verbose" )
表示 InitializeParams.Trace 的枚举值
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CancelParams ¶
CancelParams The base protocol offers support for request cancellation
type ClientCapabilities ¶
type ClientCapabilities struct {
// Workspace specific client capabilities.
Workspace struct {
// The client supports applying batch edits to the workspace by supporting
// the request 'workspace/applyEdit'
ApplyEdit bool `json:"applyEdit,omitempty"`
// Capabilities specific to `WorkspaceEdit`s
WorkspaceEdit WorkspaceEditClientCapabilities `json:"workspaceEdit,omitempty"`
// Capabilities specific to the `workspace/didChangeConfiguration` notification.
DidChangeConfiguration DidChangeConfigurationClientCapabilities `json:"didChangeConfiguration,omitempty"`
// Capabilities specific to the `workspace/didChangeWatchedFiles` notification.
DidChangeWatchedFiles DidChangeConfigurationClientCapabilities `json:"didChangeWatchedFiles,omitempty"`
// Capabilities specific to the `workspace/symbol` request.
Symbol WorkspaceSymbolClientCapabilities `json:"symbol,omitempty"`
// Capabilities specific to the `workspace/executeCommand` request.
ExecuteCommand ExecuteCommandClientCapabilities `json:"executeCommand,omitempty"`
// The client has support for workspace folders.
//
// Since 3.6.0
WorkspaceFolders bool `json:"workspaceFolders,omitempty"`
// The client supports `workspace/configuration` requests.
//
// Since 3.6.0
Configuration bool `json:"configuration,omitempty"`
} `json:"workspace,omitempty"`
// Text document specific client capabilities.
TextDocument TextDocumentClientCapabilities `json:"textDocument,omitempty"`
// Experimental client capabilities.
Experimental interface{} `json:"experimental,omitempty"`
}
ClientCapabilities 客户端的兼容列表
type CodeActionKind ¶
type CodeActionKind string
CodeActionKind the kind of a code action.
Kinds are a hierarchical list of identifiers separated by `.`, e.g. `"refactor.extract.function"`.
The set of kinds is open and client needs to announce the kinds it supports to the server during initialization.
const ( // Empty kind. CodeActionKindEmpty CodeActionKind = "" // Base kind for quickfix actions: "quickfix" CodeActionKinQuickFix CodeActionKind = "quickfix" // Base kind for refactoring actions: "refactor" CodeActionKinRefactor CodeActionKind = "refactor" // Base kind for refactoring extraction actions: "refactor.extract" // // Example extract actions: // // - Extract method // - Extract function // - Extract variable // - Extract interface from class // - ... CodeActionKinRefactorExtract CodeActionKind = "refactor.extract" // Base kind for refactoring inline actions: "refactor.inline" // // Example inline actions: // // - Inline function // - Inline variable // - Inline constant // - ... CodeActionKinRefactorInline CodeActionKind = "refactor.inline" // 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 // - ... CodeActionKinRefactorRewrite CodeActionKind = "refactor.rewrite" // Base kind for source actions: `source` // // Source code actions apply to the entire file. CodeActionKinSource CodeActionKind = "source" // Base kind for an organize imports source action: `source.organizeImports` CodeActionKinSourceOrganizeImports CodeActionKind = "source.organizeImports" )
A set of predefined code action kinds
type CodeActionOptions ¶
type CodeActionOptions struct {
WorkDoneProgressOptions
// 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"`
}
Code Action options.
type CodeLensOptions ¶
type CodeLensOptions struct {
WorkDoneProgressOptions
// Code lens has a resolve provider as well.
ResolveProvider bool `json:"resolveProvider,omitempty"`
}
Code Lens options.
type CompletionItemKind ¶
type CompletionItemKind int
CompletionItemKind the kind of a completion entry.
const ( CompletionItemKindText CompletionItemKind = iota + 1 CompletionItemKindMethod CompletionItemKindFunction CompletionItemKindConstructor CompletionItemKindField CompletionItemKindVariable CompletionItemKindClass CompletionItemKindInterface CompletionItemKindModule CompletionItemKindProperty CompletionItemKindUnit CompletionItemKindValue CompletionItemKindEnum CompletionItemKindKeyword CompletionItemKindSnippet CompletionItemKindColor CompletionItemKindFile CompletionItemKindReference CompletionItemKindFolder CompletionItemKindEnumMember CompletionItemKindConstant CompletionItemKindStruct CompletionItemKindEvent CompletionItemKindOperator CompletionItemKindTypeParameter )
CompletionItemKind 的各类枚举值
type CompletionOptions ¶
type CompletionOptions struct {
WorkDoneProgressOptions
// The server provides support to resolve additional
// information for a completion item.
ResolveProvider bool `json:"resolveProvider,omitempty"`
// The characters that trigger completion automatically.
TriggerCharacters []string `json:"triggerCharacters,omitempty"`
// The list of all possible characters that commit a completion. This field can be used
// if clients don't support individual commit characters per completion item. See
// `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport`.
//
// If a server provides both `allCommitCharacters` and commit characters on an individual
// completion item the ones on the completion item win.
//
// @since 3.2.0
AllCommitCharacters []string `json:"allCommitCharacters,omitempty"`
}
CompletionOptions completion options.
type DeclarationOptions ¶
type DeclarationOptions struct {
WorkDoneProgressOptions
}
type DeclarationRegistrationOptions ¶
type DeclarationRegistrationOptions struct {
DeclarationOptions
TextDocumentRegistrationOptions
StaticRegistrationOptions
}
type DefinitionOptions ¶
type DefinitionOptions struct {
WorkDoneProgressOptions
}
type Diagnostic ¶
type Diagnostic struct {
// The range at which the message applies.
Range core.Range `json:"range"`
// 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"`
// The diagnostic's code, which might appear in the user interface.
Code string `json:"code,omitempty"`
// A human-readable string describing the source of this
// diagnostic, e.g. 'typescript' or 'super lint'.
Source string `json:"source,omitempty"`
// The diagnostic's message.
Message string `json:"message"`
// Additional metadata about the diagnostic.
//
// @since 3.15.0
Tags []DiagnosticTag `json:"tags,omitempty"`
// 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"`
}
Diagnostic represents a diagnostic,such as a compiler error or warning. Diagnostic objects are only valid in the scope of a resource.
type DiagnosticRelatedInformation ¶
type DiagnosticRelatedInformation struct {
// The location of this related diagnostic information.
Location core.Location `json:"location"`
// The message of this related diagnostic information.
Message string `json:"message"`
}
DiagnosticRelatedInformation represents a related message and source code location for a diagnostic
This should be used to point to code locations that cause or are related to a diagnostics, e.g when duplicating a symbol in a scope.
type DiagnosticSeverity ¶
type DiagnosticSeverity int
const ( DiagnosticSeverityError DiagnosticSeverity = iota + 1 // Reports an error DiagnosticSeverityWarning // Reports a warning DiagnosticSeverityInformation // Reports an information DiagnosticSeverityHint // Reports a hint )
DiagnosticSeverity 可用的常量
type DiagnosticTag ¶
type DiagnosticTag int
DiagnosticTag the diagnostic tags.
@since 3.15.0
const ( // DiagnosticTagUnnecessary unused or unnecessary code. // // Clients are allowed to render diagnostics with this tag faded out instead of having // an error squiggle. DiagnosticTagUnnecessary DiagnosticTag = 1 // DiagnosticTagDeprecated deprecated or obsolete code. // // Clients are allowed to rendered diagnostics with this tag strike through. DiagnosticTagDeprecated DiagnosticTag = 2 )
DiagnosticTag 可用的常量列表
type DidChangeConfigurationClientCapabilities ¶
type DidChangeConfigurationClientCapabilities struct {
// Whether formatting supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
}
type DidChangeTextDocumentParams ¶
type DidChangeTextDocumentParams struct {
// The document that did change. The version number points
// to the version after all provided content changes have been applied.
TextDocument VersionedTextDocumentIdentifier `json:"textDocument"`
// The actual content changes. The content changes describe single state changes
// to the document. So if there are two content changes c1 (at array index 0) and
// c2 (at array index 1) for a document in state S then c1 moves the document from
// S to S' and c2 from S' to S”. So c1 is computed on the state S and c2 is computed
// on the state S'.
//
// To mirror the content of a document using change events use the following approach:
// - start with the same initial content
// - apply the 'textDocument/didChange' notifications in the order you recevie them.
// - apply the `TextDocumentContentChangeEvent`s in a single notification in the order
// you receive them.
ContentChanges []TextDocumentContentChangeEvent `json:"contentChanges"`
}
type DidChangeWorkspaceFoldersParams ¶
type DidChangeWorkspaceFoldersParams struct {
// The actual workspace folder change event.
Event WorkspaceFoldersChangeEvent `json:"event"`
}
DidChangeWorkspaceFoldersParams workspace/didChangeWorkspaceFolders 参数
type DidOpenTextDocumentParams ¶
type DidOpenTextDocumentParams struct {
// The document that was opened.
TextDocument TextDocumentItem `json:"textDocument"`
}
type DidSaveTextDocumentParams ¶
type DidSaveTextDocumentParams struct {
// The document that was saved.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// Optional the content when saved. Depends on the includeText value
// when the save notification was requested.
Text string `json:"text,omitempty"`
}
DidSaveTextDocumentParams textDocument/didSave 的参数
type DocumentColorOptions ¶
type DocumentColorOptions struct {
WorkDoneProgressOptions
}
type DocumentColorRegistrationOptions ¶
type DocumentColorRegistrationOptions struct {
TextDocumentRegistrationOptions
StaticRegistrationOptions
DocumentColorOptions
}
type DocumentFilter ¶
type DocumentFilter struct {
// A language id, like `typescript`.
Language string `json:"language,omitempty"`
// A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
Scheme string `json:"scheme,omitempty"`
// A glob pattern, like `*.{ts,js}`.
//
// 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`)
Pattern string `json:"pattern,omitempty"`
}
DocumentFilter denotes a document through properties like language, scheme or pattern. An example is a filter that applies to TypeScript files on disk. Another example is a filter the applies to JSON files with name package.json:
{ language: 'typescript', scheme: 'file' }
{ language: 'json', pattern: '**/package.json' }
type DocumentFormattingOptions ¶
type DocumentFormattingOptions struct {
WorkDoneProgressOptions
}
type DocumentHighlightOptions ¶
type DocumentHighlightOptions struct {
WorkDoneProgressOptions
}
type DocumentLinkOptions ¶
type DocumentLinkOptions struct {
WorkDoneProgressOptions
// Document links have a resolve provider as well.
ResolveProvider bool `json:"resolveProvider,omitempty"`
}
Document link options.
type DocumentOnTypeFormattingOptions ¶
type DocumentOnTypeFormattingOptions struct {
// A character on which formatting should be triggered, like `}`.
FirstTriggerCharacter string `json:"firstTriggerCharacter"`
// More trigger characters.
MoreTriggerCharacter []string `json:"moreTriggerCharacter,omitempty"`
}
DocumentOnTypeFormattingOptions format document on type options.
type DocumentRangeFormattingOptions ¶
type DocumentRangeFormattingOptions struct {
WorkDoneProgressOptions
}
type DocumentSelector ¶
type DocumentSelector []DocumentFilter
DocumentSelector is the combination of one or more document filters
type DocumentSymbolOptions ¶
type DocumentSymbolOptions struct {
WorkDoneProgressOptions
}
type ExecuteCommandClientCapabilities ¶
type ExecuteCommandClientCapabilities struct {
// Execute command supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
}
type ExecuteCommandOptions ¶
type ExecuteCommandOptions struct {
WorkDoneProgressOptions
// The commands to be executed on the server
Commands []string `json:"commands"`
}
Execute command options.
type FailureHandlingKind ¶
type FailureHandlingKind string
const ( // FailureHandlingKindAbort applying the workspace change is simply aborted // if one of the changes provided fails. // All operations executed before the failing operation stay executed. FailureHandlingKindAbort FailureHandlingKind = "abort" // FailureHandlingKindTransactional all operations are executed transactionally. // That means they either all succeed or no changes at all are applied to the workspace. FailureHandlingKindTransactional FailureHandlingKind = "transactional" // FailureHandlingKindTextOnlyTransactional if the workspace edit contains only textual file changes they are executed transactionally. // If resource changes (create, rename or delete file) are part of the change the failure // handling strategy is abort. FailureHandlingKindTextOnlyTransactional FailureHandlingKind = "textOnlyTransactional" // FailureHandlingKindUndo The client tries to undo the operations already executed. // But there is no guarantee that this succeeds. FailureHandlingKindUndo FailureHandlingKind = "undo" )
type FoldingRangeOptions ¶
type FoldingRangeOptions struct {
WorkDoneProgressOptions
}
type FoldingRangeProviderOptions ¶
type FoldingRangeProviderOptions struct{}
Folding range provider options.
type FoldingRangeRegistrationOptions ¶
type FoldingRangeRegistrationOptions struct {
TextDocumentRegistrationOptions
FoldingRangeOptions
StaticRegistrationOptions
}
type Hover ¶
type Hover struct {
// The hover's content
// contents MarkedString | MarkedString[] | MarkupContent;
Contents interface{} `json:"contents"`
// An optional range is a range inside a text document
// that is used to visualize a hover, e.g. by changing the background color.
Range core.Range `json:"range,omitempty"`
}
Hover the result of a hover request.
type HoverOptions ¶
type HoverOptions struct {
WorkDoneProgressOptions
}
type HoverParams ¶
type HoverParams struct {
WorkDoneProgressParams
TextDocumentPositionParams
}
type ImplementationOptions ¶
type ImplementationOptions struct {
WorkDoneProgressOptions
}
type ImplementationRegistrationOptions ¶
type ImplementationRegistrationOptions struct {
TextDocumentRegistrationOptions
ImplementationOptions
StaticRegistrationOptions
}
type InitializationOptions ¶
type InitializationOptions struct {
// 客户端的本地化 ID
//
// 服务端会根据此值决定提示内容如何翻译。
// 如果提交的 Locale 无法识别或是服务端不支持,
// 则会采用服务端的默认值,即 locale.DefaultLocaleID。
Locale string `json:"locale,omitempty"`
}
InitializationOptions 用户需要提交的自定义初始化参数
type InitializeParams ¶
type InitializeParams struct {
WorkDoneProgressParams
// The process Id of the parent process that started
// the server. Is null if the process has not been started by another process.
// If the parent process is not alive then the server should exit (see exit notification) its process.
ProcessID int `json:"processId,omitempty"`
// The rootPath of the workspace. Is null if no folder is open.
//
// @deprecated in favour of rootUri.
RootPath string `json:"rootPath,omitempty"`
// The rootUri of the workspace. Is null if no
// folder is open. If both `rootPath` and `rootUri` are set `rootUri` wins.
RootURI core.URI `json:"rootUri,omitempty"`
// User provided initialization options.
InitializationOptions *InitializationOptions `json:"initializationOptions,omitempty"`
// The capabilities provided by the client (editor or tool)
Capabilities ClientCapabilities `json:"capabilities"`
// The initial trace setting. If omitted trace is disabled ('off').
Trace string `json:"trace,omitempty"`
// The workspace folders configured in the client when the server starts.
// This property is only available if the client supports workspace folders.
// It can be `null` if the client supports workspace folders but none are
// configured.
//
// Since 3.6.0
//
// 在客户端支持工作区的情况下,RootURI 和 RootPath 的内容为 WorkspaceFolders 的第一个元素,
// 否则 WorkspaceFolders 为空。
// RootURI 和 RootPath 的区别在于,RootURI 会带协议,比如 file:///path 而 RootPath 为 /path
WorkspaceFolders []WorkspaceFolder `json:"workspaceFolders,omitempty"`
// Information about the client
//
// @since 3.15.0
ClientInfo *ServerInfo `json:"clientInfo,omitempty"`
}
InitializeParams 初始化请求的参数
func (*InitializeParams) Folders ¶
func (p *InitializeParams) Folders() []WorkspaceFolder
Folders 获取客户端当前打开的所有项目
type InitializeResult ¶
type InitializeResult struct {
// The capabilities the language server provides.
Capabilities ServerCapabilities `json:"capabilities"`
// Information about the server.
//
// @since 3.15.0
ServerInfo *ServerInfo `json:"serverInfo,omitempty"`
}
InitializeResult initialize 服务的返回结构
type LogMessageParams ¶
type LogMessageParams struct {
// The message type. See {@link MessageType}
Type MessageType `json:"type"`
// The actual message
Message string `json:"message"`
}
type MarkupContent ¶
type MarkupContent struct {
// The type of the Markup
Kind MarkupKind `json:"kind"`
// The content itself
Value string `json:"value"`
}
*
- 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:
- ```typescript
- 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 MarkupKind ¶
type MarkupKind string
MarkupKind describes the content type that a client supports in various result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
Please note that `MarkupKinds` must not start with a `$`. This kinds are reserved for internal usage.
const ( // MarkupKindPlainText plain text is supported as a content format MarkupKindPlainText MarkupKind = "plaintext" // MarkupKinMarkdown markdown is supported as a content format MarkupKinMarkdown MarkupKind = "markdown" )
type MessageActionItem ¶
type MessageActionItem struct {
// A short title like 'Retry', 'Open Log' etc.
Title string `json:"title"`
}
type MessageType ¶
type MessageType int
const ( Error MessageType = iota + 1 // An error message. Warning // A warning message. Info // An information message. Log // A log message. )
type ProgressToken ¶
type ProgressToken interface{}
ProgressToken type ProgressToken = number | string;
type PublishDiagnosticsParams ¶
type PublishDiagnosticsParams struct {
// The URI for which diagnostic information is reported.
URI core.URI `json:"uri"`
// Optional the version number of the document the diagnostics are published for.
//
// @since 3.15.0
Version int `json:"version,omitempty"`
// An array of diagnostic information items.
Diagnostics []Diagnostic `json:"diagnostics"`
}
PublishDiagnosticsParams textDocument/publishDiagnostics 事件发送的参数
type ReferenceOptions ¶
type ReferenceOptions struct {
WorkDoneProgressOptions
}
type RenameOptions ¶
type RenameOptions struct {
WorkDoneProgressOptions
// Renames should be checked and tested before being executed.
PrepareProvider bool `json:"prepareProvider,omitempty"`
}
Rename options
type ResourceOperationKind ¶
type ResourceOperationKind string
ResourceOperationKind the kind of resource operations supported by the client.
const ( // ResourceOperationKindCreate supports creating new files and folders. ResourceOperationKindCreate ResourceOperationKind = "create" // ResourceOperationKindRename supports renaming existing files and folders. ResourceOperationKindRename ResourceOperationKind = "rename" // ResourceOperationKindDelete supports deleting existing files and folders. ResourceOperationKindDelete ResourceOperationKind = "delete" )
type SaveOptions ¶
type SaveOptions struct {
// The client is supposed to include the content on save.
IncludeText bool `json:"includeText,omitempty"`
}
Save options.
type SelectionRangeOptions ¶
type SelectionRangeOptions struct {
WorkDoneProgressOptions
}
type SelectionRangeRegistrationOptions ¶
type SelectionRangeRegistrationOptions struct {
SelectionRangeOptions
TextDocumentRegistrationOptions
StaticRegistrationOptions
}
type ServerCapabilities ¶
type ServerCapabilities struct {
// Defines how text documents are synced. Is either a detailed structure defining each notification or
// for backwards compatibility the TextDocumentSyncKind number.
// If omitted it defaults to `TextDocumentSyncKind.None`.
//
// ServerCapabilitiesTextDocumentSyncOptions | TextDocumentSyncKind;
TextDocumentSync interface{} `json:"textDocumentSync"`
// The server provides completion support.
CompletionProvider CompletionOptions `json:"completionProvider,omitempty"`
// The server provides hover support.
//
// boolean | HoverOptions
HoverProvider interface{} `json:"hoverProvider,omitempty"`
// The server provides signature help support.
SignatureHelpProvider SignatureHelpOptions `json:"signatureHelpProvider,omitempty"`
// The server provides go to declaration support.
//
// Since 3.14.0
//
// boolean | DeclarationOptions | DeclarationRegistrationOptions
DeclarationProvider interface{} `json:"declarationProvider,omitempty"`
// The server provides goto definition support.
//
// boolean | DefinitionOptions;
DefinitionProvider interface{} `json:"definitionProvider,omitempty"`
// The server provides Goto Type Definition support.
//
// Since 3.6.0
//
// boolean | TypeDefinitionOptions | TypeDefinitionRegistrationOptions;
TypeDefinitionProvider interface{} `json:"typeDefinitionProvider,omitempty"`
// The server provides Goto Implementation support.
//
// Since 3.6.0
//
// boolean | ImplementationOptions | ImplementationRegistrationOptions;
ImplementationProvider interface{} `json:"implementationProvider,omitempty"`
// The server provides find references support.
//
// boolean | ReferenceOptions
ReferencesProvider interface{} `json:"referencesProvider,omitempty"`
// The server provides document highlight support.
//
// boolean | DocumentHighlightOptions
DocumentHighlightProvider interface{} `json:"documentHighlightProvider,omitempty"`
// The server provides document symbol support.
//
// boolean | DocumentSymbolOptions;
DocumentSymbolProvider interface{} `json:"documentSymbolProvider,omitempty"`
// The server provides code actions. The `CodeActionOptions` return type is only
// valid if the client signals code action literal support via the property
// `textDocument.codeAction.codeActionLiteralSupport`.
//
// boolean | CodeActionOptions;
CodeActionProvider interface{} `json:"codeActionProvider,omitempty"`
// The server provides code lens.
CodeLensProvider CodeLensOptions `json:"codeLensProvider,omitempty"`
// The server provides document link support.
DocumentLinkProvider DocumentLinkOptions `json:"documentLinkProvider,omitempty"`
// The server provides color provider support.
//
// Since 3.6.0
//
// boolean | DocumentColorOptions | DocumentColorRegistrationOptions;
ColorProvider interface{} `json:"colorProvider,omitempty"`
// The server provides document formatting.
//
// boolean | DocumentFormattingOptions;
DocumentFormattingProvider interface{} `json:"documentFormattingProvider,omitempty"`
// The server provides document range formatting.
//
// boolean | DocumentRangeFormattingOptions;
DocumentRangeFormattingProvider interface{} `json:"documentRangeFormattingProvider,omitempty"`
// The server provides document formatting on typing.
DocumentOnTypeFormattingProvider DocumentOnTypeFormattingOptions `json:"documentOnTypeFormattingProvider,omitempty"`
// The server provides rename support. RenameOptions may only be
// specified if the client states that it supports
// `prepareSupport` in its initial `initialize` request.
//
// boolean | RenameOptions;
RenameProvider interface{} `json:"renameProvider,omitempty"`
// The server provides folding provider support.
//
// Since 3.10.0
//
// boolean | FoldingRangeOptions | FoldingRangeRegistrationOptions;
FoldingRangeProvider interface{} `json:"foldingRangeProvider,omitempty"`
// The server provides execute command support.
ExecuteCommandProvider ExecuteCommandOptions `json:"executeCommandProvider,omitempty"`
// The server provides selection range support.
//
// @since 3.15.0
//
// boolean | SelectionRangeOptions | SelectionRangeRegistrationOptions
SelectionRangeProvider interface{} `json:"selectionRangeProvider,omitempty"`
// The server provides workspace symbol support.
WorkspaceSymbolProvider bool `json:"workspaceSymbolProvider,omitempty"`
// Workspace specific server capabilities
Workspace struct {
// The server supports workspace folder.
//
// Since 3.6.0
WorkspaceFolders WorkspaceFoldersServerCapabilities `json:"workspaceFolders,omitempty"`
} `json:"workspace,omitempty"`
// Experimental server capabilities.
Experimental interface{} `json:"experimental,omitempty"`
}
ServerCapabilities 服务端的兼容列表
type ServerCapabilitiesTextDocumentSyncOptions ¶
type ServerCapabilitiesTextDocumentSyncOptions struct {
// Open and close notifications are sent to the server.
// If omitted open close notification should not be sent.
OpenClose bool `json:"openClose,omitempty"`
// Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full
// and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None.
Change TextDocumentSyncKind `json:"change,omitempty"`
}
type ShowMessageParams ¶
type ShowMessageParams struct {
// The message type. See {@link MessageType}.
Type MessageType `json:"type"`
// The actual message.
Message string `json:"message"`
}
type ShowMessageRequestParams ¶
type ShowMessageRequestParams struct {
// The message type. See {@link MessageType}
Type MessageType `json:"type"`
// The actual message
Message string `json:"message"`
// The message action items to present.
Actions []MessageActionItem `json:"actions,omitempty"`
}
type SignatureHelpOptions ¶
type SignatureHelpOptions struct {
WorkDoneProgressOptions
// The characters that trigger signature help automatically.
TriggerCharacters []string `json:"triggerCharacters,omitempty"`
// List of characters that re-trigger signature help.
//
// These trigger characters are only active when signature help is already showing. All trigger characters
// are also counted as re-trigger characters.
//
// @since 3.15.0
RetriggerCharacters []string `json:"retriggerCharacters,omitempty"`
}
Signature help options.
type StaticRegistrationOptions ¶
type StaticRegistrationOptions struct {
// 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"`
}
StaticRegistrationOptions static registration options to be returned in the initialize request.
type SymbolKind ¶
type SymbolKind int
SymbolKind A symbol kind.
const ( SymbolKindFile SymbolKind = iota + 1 SymbolKindModule SymbolKindNamespace SymbolKindPackage SymbolKindClass SymbolKindMethod SymbolKindProperty SymbolKindField SymbolKindConstructor SymbolKindEnum SymbolKindInterface SymbolKindFunction SymbolKindVariable SymbolKindConstant SymbolKindString SymbolKindNumber SymbolKindBoolean SymbolKindArray SymbolKindObject SymbolKindKey SymbolKindNull SymbolKindEnumMember SymbolKindStruct SymbolKindEvent SymbolKindOperator SymbolKindTypeParameter )
SymbolKind 的各类枚举值
type TextDocumentClientCapabilities ¶
type TextDocumentClientCapabilities struct {
Synchronization struct {
// Whether text document synchronization supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// The client supports sending will save notifications.
WillSave bool `json:"willSave,omitempty"`
// 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"`
// The client supports did save notifications.
DidSave bool `json:"didSave,omitempty"`
} `json:"synchronization,omitempty"`
// Capabilities specific to the `textDocument/completion`
Completion struct {
// Whether completion supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// The client supports the following `CompletionItem` specific
// capabilities.
CompletionItem struct {
// The 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"`
// The client supports commit characters on a completion item.
CommitCharactersSupport bool `json:"commitCharactersSupport,omitempty"`
// The client supports the following content formats for the documentation
// property. The order describes the preferred format of the client.
DocumentationFormat []MarkupKind `json:"documentationFormat,omitempty"`
// The client supports the deprecated property on a completion item.
DeprecatedSupport bool `json:"deprecatedSupport,omitempty"`
// The client supports the preselect property on a completion item.
PreselectSupport bool `json:"preselectSupport,omitempty"`
} `json:"completionItem,omitempty"`
CompletionItemKind struct {
/**
* 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"`
/**
* The client supports to send additional context information for a
* `textDocument/completion` request.
*/
ContextSupport bool `json:"contextSupport,omitempty"`
} `json:"completion,omitempty"`
// Capabilities specific to the `textDocument/hover`
Hover struct {
// Whether hover supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// The 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"`
// Capabilities specific to the `textDocument/signatureHelp`
SignatureHelp struct {
// Whether signature help supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// The client supports the following `SignatureInformation` specific properties.
SignatureInformation struct {
// The client supports the follow content formats for the documentation
// property. The order describes the preferred format of the client.
DocumentationFormat []MarkupKind `json:"documentationFormat,omitempty"`
// Client capabilities specific to parameter information.
ParameterInformation struct {
// The client supports processing label offsets instead of a
// simple label string.
//
// Since 3.14.0
LabelOffsetSupport bool `json:"labelOffsetSupport,omitempty"`
} `json:"parameterInformation,omitempty"`
} `json:"signatureInformation,omitempty"`
} `json:"signatureHelp,omitempty"`
// Capabilities specific to the `textDocument/references`
References DidChangeConfigurationClientCapabilities `json:"references,omitempty"`
// Capabilities specific to the `textDocument/documentHighlight`
DocumentHighlight DidChangeConfigurationClientCapabilities `json:"documentHighlight,omitempty"`
// Capabilities specific to the `textDocument/documentSymbol`
DocumentSymbol struct {
// Whether document symbol supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// Specific capabilities for the `SymbolKind`.
SymbolKind struct {
// 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"`
// The client supports hierarchical document symbols.
HierarchicalDocumentSymbolSupport bool `json:"hierarchicalDocumentSymbolSupport,omitempty"`
} `json:"documentSymbol,omitempty"`
// Capabilities specific to the `textDocument/formatting`
Formatting DidChangeConfigurationClientCapabilities `json:"formatting,omitempty"`
// Capabilities specific to the `textDocument/rangeFormatting`
RangeFormatting DidChangeConfigurationClientCapabilities `json:"rangeFormatting,omitempty"`
// Capabilities specific to the `textDocument/onTypeFormatting`
OnTypeFormatting DidChangeConfigurationClientCapabilities `json:"onTypeFormatting,omitempty"`
// Capabilities specific to the `textDocument/declaration`
Declaration struct {
// 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"`
// The client supports additional metadata in the form of declaration links.
//
// Since 3.14.0
LinkSupport bool `json:"linkSupport,omitempty"`
} `json:"declaration,omitempty"`
// Capabilities specific to the `textDocument/definition`.
//
// Since 3.14.0
Definition struct {
// Whether definition supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// The client supports additional metadata in the form of definition links.
LinkSupport bool `json:"linkSupport,omitempty"`
} `json:"definition,omitempty"`
// Capabilities specific to the `textDocument/typeDefinition`
//
// Since 3.6.0
TypeDefinition struct {
// Whether typeDefinition 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"`
// The client supports additional metadata in the form of definition links.
//
// Since 3.14.0
LinkSupport bool `json:"linkSupport,omitempty"`
} `json:"typeDefinition,omitempty"`
// Capabilities specific to the `textDocument/implementation`.
//
// Since 3.6.0
Implementation struct {
// 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"`
// The client supports additional metadata in the form of definition links.
//
// Since 3.14.0
LinkSupport bool `json:"linkSupport,omitempty"`
} `json:"implementation,omitempty"`
// Capabilities specific to the `textDocument/codeAction`
CodeAction struct {
// Whether code action supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// The client support code action literals as a valid
// response of the `textDocument/codeAction` request.
//
// Since 3.8.0
CodeActionLiteralSupport struct {
// The code action kind is support with the following value set.
CodeActionKind struct {
// 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"`
// Capabilities specific to the `textDocument/codeLens`
CodeLens DidChangeConfigurationClientCapabilities `json:"codeLens,omitempty"`
// Capabilities specific to the `textDocument/documentLink`
DocumentLink DidChangeConfigurationClientCapabilities `json:"documentLink,omitempty"`
// Capabilities specific to the `textDocument/documentColor` and the
// `textDocument/colorPresentation` request.
//
// Since 3.6.0
//
// If ColorProvider.DidChangeConfigurationClientCapabilities is set to `true`
// the client supports the new `(ColorProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)`
// return value for the corresponding server capability as well.
ColorProvider DidChangeConfigurationClientCapabilities `json:"colorProvider,omitempty"`
// Capabilities specific to the `textDocument/rename`
Rename struct {
// Whether rename supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// The client supports testing for validity of rename operation before execution.
PrepareSupport bool `json:"prepareSupport,omitempty"`
} `json:"rename,omitempty"`
// Capabilities specific to `textDocument/publishDiagnostics`.
PublishDiagnostics struct {
// Whether the clients accepts diagnostics with related information.
RelatedInformation bool `json:"relatedInformation,omitempty"`
// Client supports the tag property to provide meta data about a diagnostic.
// Clients supporting tags have to handle unknown tags gracefully.
//
// @since 3.15.0
TagSupport struct {
// The tags supported by the client.
ValueSet []DiagnosticTag `json:"valueSet,omitempty"`
} `json:"tagSupport,omitempty"`
// Whether the client interprets the version property of the
// `textDocument/publishDiagnostics` notification's parameter.
//
// @since 3.15.0
VersionSupport bool `json:"versionSupport,omitempty"`
} `json:"publishDiagnostics,omitempty"`
// Capabilities specific to `textDocument/foldingRange` requests.
//
// Since 3.10.0
FoldingRange struct {
// 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"`
// 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 int `json:"rangeLimit,omitempty"`
// 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"`
}
TextDocumentClientCapabilities text document specific client capabilities.
type TextDocumentContentChangeEvent ¶
type TextDocumentContentChangeEvent struct {
// The range of the document that changed.
Range *core.Range `json:"range,omitempty"`
// The new text for the provided range.
// The new text of the whole document.
//
// 如果没有 Range 内容,表示整个文档内容;否则表示 Range 表示的内容
Text string `json:"text"`
// The optional length of the range that got replaced.
//
// @deprecated use range instead.
RangeLength int `json:"rangeLength,omitempty"`
}
TextDocumentContentChangeEvent 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 TextDocumentIdentifier ¶
TextDocumentIdentifier text documents are identified using a URI. On the protocol level, URIs are passed as strings. The corresponding JSON structure looks like this:
type TextDocumentItem ¶
type TextDocumentItem struct {
// The text document's URI.
URI core.URI `json:"uri"`
// The text document's language identifier.
LanguageID string `json:"languageId"`
// The version number of this document (it will increase after each
// change, including undo/redo).
Version int `json:"version"`
// The content of the opened text document.
Text string `json:"text"`
}
TextDocumentItem an item to transfer a text document from the client to the server.
type TextDocumentPositionParams ¶
type TextDocumentPositionParams struct {
// The text document.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// The position inside the text document.
Position core.Position `json:"position"`
}
TextDocumentPositionParams a parameter literal used in requests to pass a text document and a position inside that document.
type TextDocumentRegistrationOptions ¶
type TextDocumentRegistrationOptions struct {
// 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,omitempty"`
}
type TextDocumentSyncKind ¶
type TextDocumentSyncKind int
TextDocumentSyncKind defines how the host (editor) should sync document changes to the language server.
const ( // TextDocumentSyncKindNone documents should not be synced at all. TextDocumentSyncKindNone TextDocumentSyncKind = iota // TextDocumentSyncKindFull documents are synced by always sending the full content of the document. TextDocumentSyncKindFull // TextDocumentSyncKindIncremental documents are synced by sending the full content on open. // After that only incremental updates to the document are send. TextDocumentSyncKindIncremental )
type TextDocumentSyncOptions ¶
type TextDocumentSyncOptions struct {
ServerCapabilitiesTextDocumentSyncOptions
// If present will save notifications are sent to the server.
// If omitted the notification should not be sent.
WillSave bool `json:"willSave,omitempty"`
// If present will save wait until requests are sent to the server.
// If omitted the request should not be sent.
WillSaveWaitUntil bool `json:"willSaveWaitUntil,omitempty"`
// If present save notifications are sent to the server.
// If omitted the notification should not be sent.
Save SaveOptions `json:"save,omitempty"`
}
type TypeDefinitionOptions ¶
type TypeDefinitionOptions struct {
WorkDoneProgressOptions
}
type TypeDefinitionRegistrationOptions ¶
type TypeDefinitionRegistrationOptions struct {
TextDocumentRegistrationOptions
TypeDefinitionOptions
StaticRegistrationOptions
}
type VersionedTextDocumentIdentifier ¶
type VersionedTextDocumentIdentifier struct {
TextDocumentIdentifier
// 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 known and the content on disk is the
// truth (as speced with document content ownership).
//
// The version number of a document will increase after each change, including
// undo/redo. The number doesn't need to be consecutive.
Version int `json:"version,omitempty"`
}
VersionedTextDocumentIdentifier an identifier to denote a specific version of a text document.
type WorkDoneProgressOptions ¶
type WorkDoneProgressOptions struct {
WorkDoneProgress bool `json:"workDoneProgress,omitempty"`
}
WorkDoneProgressOptions options to signal work done progress support in server capabilities.
type WorkDoneProgressParams ¶
type WorkDoneProgressParams struct {
// An optional token that a server can use to report work done progress.
WorkDoneToken ProgressToken `json:"workDoneToken,omitempty"`
}
WorkDoneProgressParams a parameter literal used to pass a work done progress token.
type WorkspaceEditClientCapabilities ¶
type WorkspaceEditClientCapabilities struct {
// The client supports versioned document changes in `WorkspaceEdit`s
DocumentChanges bool `json:"documentChanges,omitempty"`
// The resource operations the client supports. Clients should at least
// support 'create', 'rename' and 'delete' files and folders.
//
// @since 3.13.0
ResourceOperations []ResourceOperationKind `json:"resourceOperations,omitempty"`
// The failure handling strategy of a client if applying the workspace edit fails.
//
// @since 3.13.0
FailureHandling FailureHandlingKind `json:"failureHandling,omitempty"`
}
type WorkspaceFolder ¶
type WorkspaceFoldersChangeEvent ¶
type WorkspaceFoldersChangeEvent struct {
// The array of added workspace folders
Added []WorkspaceFolder `json:"added"`
// The array of the removed workspace folders
Removed []WorkspaceFolder `json:"removed"`
}
WorkspaceFoldersChangeEvent the workspace folder change event.
type WorkspaceFoldersServerCapabilities ¶
type WorkspaceFoldersServerCapabilities struct {
// The server has support for workspace folders
Supported bool `json:"supported,omitempty"`
// Whether the server wants to receive workspace folder
// change notifications.
//
// If a string is provided, the string is treated as an ID
// under which the notification is registered on the client
// side. The ID can be used to unregister for these events
// using the `client/unregisterCapability` request.
//
// string | boolean;
ChangeNotifications interface{} `json:"changeNotifications,omitempty"`
}
type WorkspaceSymbolClientCapabilities ¶
type WorkspaceSymbolClientCapabilities struct {
// Symbol request supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
SymbolKind struct {
// 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"`
}