Documentation
¶
Index ¶
- Constants
- type ChangeAnnotation
- type ClientCapabilities
- type ClientInfo
- type CodeAction
- type CodeActionContext
- type CodeActionDisabled
- type CodeActionKind
- type CodeActionParams
- type CodeActionTriggerKind
- type CodeDescription
- type Command
- type CompletionContext
- type CompletionItem
- type CompletionItemCapability
- type CompletionItemKind
- type CompletionItemLabelDetails
- type CompletionItemTag
- type CompletionList
- type CompletionOptions
- type CompletionParams
- type CompletionResponse
- type CompletionTriggerKind
- type CreateFile
- type CreateFileOptions
- type DefinitionParams
- type DefinitionResponse
- type DeleteFile
- type DeleteFileOptions
- type Diagnostic
- type DiagnosticOptions
- type DiagnosticRelatedInformation
- type DiagnosticSeverity
- type DiagnosticTag
- type DidChangeTextDocumentParams
- type DidCloseTextDocumentParams
- type DidOpenTextDocumentParams
- type DidSaveTextDocumentParams
- type DocumentChangeOperation
- type DocumentDiagnosticParams
- type DocumentDiagnosticReport
- type DocumentURI
- type FullDocumentDiagnosticReport
- type Hover
- type HoverParams
- type HoverResult
- type InitializeParams
- type InitializeResult
- type InsertTextFormat
- type InsertTextMode
- type LSPAny
- type LanguageID
- type Location
- type LocationLink
- type MarkedString
- type MarkupContent
- type MarkupContentOrMarkedString
- type MarkupKind
- type PartialResultParams
- type Position
- type PositionEncodingKind
- type ProgressToken
- type Range
- type RenameFile
- type RenameFileOptions
- type ResourceOperation
- type ServerCapabilities
- type ServerInfo
- type SignatureHelpOptions
- type TextDocumentContentChangeEvent
- type TextDocumentEdit
- type TextDocumentIdentifier
- type TextDocumentItem
- type TextDocumentPositionParams
- type TextDocumentSyncKind
- type TextEdit
- type TraceValue
- type UnchangedDocumentDiagnosticReport
- type VersionedTextDocumentIdentifier
- type WorkDoneProgressOptions
- type WorkDoneProgressParams
- type WorkspaceEdit
- type WorkspaceFolder
Constants ¶
const ( MethodTextDocumentDidOpen = "textDocument/didOpen" MethodTextDocumentDidClose = "textDocument/didClose" MethodTextDocumentDidChange = "textDocument/didChange" MethodTextDocumentDidSave = "textDocument/didSave" )
const ( MethodInitialize = "initialize" MethodInitialized = "initialized" )
const (
// MethodTextDocumentCodeAction method name of "textDocument/codeAction".
MethodTextDocumentCodeAction = "textDocument/codeAction"
)
const (
// MethodTextDocumentCompletion method name of "textDocument/completion".
MethodTextDocumentCompletion = "textDocument/completion"
)
const (
// MethodTextDocumentDefinition method name of "textDocument/definition".
MethodTextDocumentDefinition = "textDocument/definition"
)
const (
MethodTextDocumentDiagnostic = "textDocument/diagnostic"
)
const (
MethodTextDocumentHover = "textDocument/hover"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangeAnnotation ¶ added in v0.0.7
type ChangeAnnotation struct {
// A human-readable string describing the actual change. The string is
// rendered prominent in the user interface.
Label string `json:"label"`
// A flag which indicates that user confirmation is needed
// before applying the change.
NeedsConfirmation *bool `json:"needsConfirmation,omitempty"`
// A human-readable string which is rendered less prominent in the
// user interface.
Description string `json:"description,omitempty"`
}
A change annotation represents additional information that describes a change.
@since 3.16.0
type ClientCapabilities ¶
type ClientCapabilities struct{}
ClientCapabilities defines the capabilities of the client (e.g., editor or IDE). It tells the language server what features the client supports.
type ClientInfo ¶
type ClientInfo struct {
// The name of the client as defined by the client.
// For example "vscode", "emacs" or "vim".
Name string `json:"name"`
// The client's version as defined by the client.
Version *string `json:"version,omitempty"`
}
Information about the client. The client provides this information during the initialize request.
@since 3.15.0
type CodeAction ¶
type CodeAction struct {
// A short, human-readable, title for this code action.
Title string `json:"title"`
// The kind of the code action.
// Used to filter code actions.
Kind CodeActionKind `json:"kind,omitempty"`
// The diagnostics that this code action resolves.
Diagnostics []Diagnostic `json:"diagnostics,omitempty"`
// Marks this as a preferred action.
// Preferred actions are used by the `auto fix` command and can be targeted by keybindings.
// @since 3.15.0
IsPreferred bool `json:"isPreferred,omitempty"`
// Marks that the code action cannot currently be applied.
// Clients should follow the `disabled` property to determine if the action is shown in the UI.
// @since 3.16.0
Disabled *CodeActionDisabled `json:"disabled,omitempty"`
// The workspace edit this code action performs.
Edit *WorkspaceEdit `json:"edit,omitempty"`
// A command this code action executes. If both `edit` and `command` are specified, edit is applied first.
Command *Command `json:"command,omitempty"`
// A data entry field that is preserved between a `textDocument/codeAction` request and a `codeAction/resolve` request.
// @since 3.16.0
Data any `json:"data,omitempty"`
}
A code action represents a change that can be performed in code, e.g. to fix a problem or to refactor code.
type CodeActionContext ¶
type CodeActionContext struct {
// An array of diagnostics known on the client side overlapping the range provided to the `textDocument/codeAction` request.
Diagnostics []Diagnostic `json:"diagnostics"`
// 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.
// @since 3.15.0
Only []CodeActionKind `json:"only,omitempty"`
// The reason why code actions were requested.
// @since 3.17.0
TriggerKind CodeActionTriggerKind `json:"triggerKind,omitempty"`
}
CodeActionContext contains additional diagnostic information about the context in which a code action is run.
type CodeActionDisabled ¶ added in v0.0.7
type CodeActionDisabled struct {
// Human-readable description of why the code action is currently disabled.
// This is displayed in the UI.
Reason string `json:"reason"`
}
`CodeActionDisabled` is used to signal to the client that a code action is currently disabled and not applicable in the current context.
type CodeActionKind ¶
type CodeActionKind string
CodeActionKind defines the type of code action.
const ( CodeActionQuickFix CodeActionKind = "quickfix" CodeActionRefactor CodeActionKind = "refactor" CodeActionRefactorExtract CodeActionKind = "refactor.extract" CodeActionRefactorInline CodeActionKind = "refactor.inline" CodeActionRefactorRewrite CodeActionKind = "refactor.rewrite" CodeActionSource CodeActionKind = "source" CodeActionSourceOrganizeImports CodeActionKind = "source.organizeImports" )
type CodeActionParams ¶
type CodeActionParams struct {
WorkDoneProgressParams
PartialResultParams
// The text document in which the command was invoked.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// The range for which the command was invoked.
Range Range `json:"range"`
// Context carrying additional information.
Context CodeActionContext `json:"context"`
}
CodeActionParams defines the parameters passed to the `textDocument/codeAction` request.
type CodeActionTriggerKind ¶ added in v0.0.7
type CodeActionTriggerKind int
The reason why code actions were requested.
@since 3.17.0
const ( // Code actions were explicitly requested by the user or by an extension. CodeActionTriggerKindInvoked CodeActionTriggerKind = 1 // Code actions were requested automatically. // This typically happens when a diagnostic is reported and code actions are requested. // This kind of request should not trigger UI (e.g. prompt the user to pick a code action). CodeActionTriggerKindAutomatic CodeActionTriggerKind = 2 )
type CodeDescription ¶
type CodeDescription struct {
// An URI to open with more information about the diagnostic error.
Href DocumentURI `json:"href"`
}
Structure to capture a description for an error code.
@since 3.16.0
type Command ¶
type Command struct {
// Title of the command, like `save`.
Title string `json:"title"`
// The identifier of the actual command handler.
Command string `json:"command"`
// Arguments that the command handler should be invoked with.
Arguments []LSPAny `json:"arguments,omitempty"`
}
Represents a reference to a command. Provides a title which will be used to represent a command in the UI and optionally a command identifier and arguments.
See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#command
type CompletionContext ¶
type CompletionContext struct {
// How the completion was triggered.
TriggerKind CompletionTriggerKind `json:"triggerKind"`
// The trigger character (a single character) that has trigger code complete.
// Is undefined if `triggerKind !== CompletionTriggerKindTriggerCharacter`
TriggerCharacter string `json:"triggerCharacter,omitempty"`
}
Contains additional information about the context in which a completion request is triggered.
type CompletionItem ¶
type CompletionItem struct {
// The label of this completion item.
//
// The label property is also by default the text that
// is inserted when selecting this completion.
//
// If label details are provided the label itself should
// be an unqualified name of the completion item.
Label string `json:"label"`
// Additional details for the label.
//
// @since 3.17.0
LabelDetails *CompletionItemLabelDetails `json:"labelDetails,omitempty"`
// The kind of this completion item. Based of the kind
// an icon is chosen by the editor. The standardized set
// of available values is defined in `CompletionItemKind`.
Kind CompletionItemKind `json:"kind,omitempty"`
// Tags for this completion item.
//
// @since 3.15.0
Tags []CompletionItemTag `json:"tags,omitempty"`
// A human-readable string with additional information
// about this item, like type or symbol information.
Detail string `json:"detail,omitempty"`
// A human-readable string that represents a doc-comment.
Documentation string `json:"documentation,omitempty"`
// Indicates if this item is deprecated.
//
// Deprecated: Use `tags` instead if supported.
Deprecated *bool `json:"deprecated,omitempty"`
// 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"`
// A string that should be used when comparing this item
// with other items. When omitted the label is used
// as the sort text for this item.
SortText string `json:"sortText,omitempty"`
// A string that should be used when filtering a set of
// completion items. When omitted the label is used as the
// filter text for this item.
FilterText string `json:"filterText,omitempty"`
// A string that should be inserted into a document when selecting
// this completion. When omitted the label is used as the insert text
// for this item.
//
// 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<cursor position>` 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.
InsertText string `json:"insertText,omitempty"`
// The format of the insert text. The format applies to both the
// `insertText` property and the `newText` property of a provided
// `textEdit`. If omitted defaults to `InsertTextFormat.PlainText`.
//
// Please note that the insertTextFormat doesn't apply to
// `additionalTextEdits`.
InsrtTextFormat *InsertTextFormat `json:"insertTextFormat,omitempty"`
// How whitespace and indentation is handled during completion
// item insertion. If not provided the client's default value depends on
// the `textDocument.completion.insertTextMode` client capability.
//
// @since 3.16.0
// @since 3.17.0 - support for `textDocument.completion.insertTextMode`
InsertTextMode *InsertTextMode `json:"insertTextMode,omitempty"`
// An edit which is applied to a document when selecting this completion.
// When an edit is provided the value of `insertText` is ignored.
//
// *Note:* The range of the edit must be a single line range and it must
// contain the position at which completion has been requested.
//
// Most editors support two different operations when accepting a completion
// item. One is to insert a completion text and the other is to replace an
// existing text with a completion text. Since this can usually not be
// predetermined by a server it can report both ranges. Clients need to
// signal support for `InsertReplaceEdit`s via the
// `textDocument.completion.completionItem.insertReplaceSupport` client
// capability property.
//
// Note 1: The text edit's range as well as both ranges from an insert
// replace edit must be a [single line] and they must contain the position
// at which completion has been requested.
// Note 2: If an `InsertReplaceEdit` is returned the edit's insert range
// must be a prefix of the edit's replace range, that means it must be
// contained and starting at the same position.
//
// @since 3.16.0 additional type `InsertReplaceEdit`
TextEdit *TextEdit `json:"textEdit,omitempty"`
// The edit text used if the completion item is part of a CompletionList and
// CompletionList defines an item default for the text edit range.
//
// Clients will only honor this property if they opt into completion list
// item defaults using the capability `completionList.itemDefaults`.
//
// If not provided and a list's default range is provided the label
// property is used as a text.
//
// @since 3.17.0
TextEditText string `json:"textEditText,omitempty"`
// An optional array of additional text edits that are applied when
// selecting this completion. Edits must not overlap (including the same
// insert position) with the main edit 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"`
// 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"`
// An optional command that is executed *after* inserting this completion.
// Note that additional modifications to the current document should be
// described with the additionalTextEdits-property.
Command *Command `json:"command,omitempty"`
// A data entry field that is preserved on a completion item between
// a completion and a completion resolve request.
Data LSPAny `json:"data,omitempty"`
}
A completion item represents a suggestion to complete text, typically during typing.
type CompletionItemCapability ¶ added in v0.0.7
type CompletionItemCapability struct {
// The server has support for completion item label details (see also `CompletionItemLabelDetails`)
// when receiving a completion item in a resolve call.
// @since 3.17.0
LabelDetailsSupport *bool `json:"labelDetailsSupport,omitempty"`
}
Capabilities specific to the `CompletionItem`.
@since 3.17.0
type CompletionItemKind ¶
type CompletionItemKind int
The kind of a completion entry.
const ( CompletionItemKindNone CompletionItemKind = 0 CompletionItemKindText CompletionItemKind = 1 CompletionItemKindMethod CompletionItemKind = 2 CompletionItemKindFunction CompletionItemKind = 3 CompletionItemKindConstructor CompletionItemKind = 4 CompletionItemKindField CompletionItemKind = 5 CompletionItemKindVariable CompletionItemKind = 6 CompletionItemKindClass CompletionItemKind = 7 CompletionItemKindInterface CompletionItemKind = 8 CompletionItemKindModule CompletionItemKind = 9 CompletionItemKindProperty CompletionItemKind = 10 CompletionItemKindUnit CompletionItemKind = 11 CompletionItemKindValue CompletionItemKind = 12 CompletionItemKindEnum CompletionItemKind = 13 CompletionItemKindKeyword CompletionItemKind = 14 CompletionItemKindSnippet CompletionItemKind = 15 CompletionItemKindColor CompletionItemKind = 16 CompletionItemKindFile CompletionItemKind = 17 CompletionItemKindReference CompletionItemKind = 18 CompletionItemKindFolder CompletionItemKind = 19 CompletionItemKindEnumMember CompletionItemKind = 20 CompletionItemKindConstant CompletionItemKind = 21 CompletionItemKindStruct CompletionItemKind = 22 CompletionItemKindEvent CompletionItemKind = 23 CompletionItemKindOperator CompletionItemKind = 24 CompletionItemKindTypeParameter CompletionItemKind = 25 )
type CompletionItemLabelDetails ¶ added in v0.0.7
type CompletionItemLabelDetails struct {
// An optional string which is rendered less prominently directly after `CompletionItem.label`, without any spacing.
Detail *string `json:"detail,omitempty"`
// An optional string which is rendered less prominently after `CompletionItem.detail`. It should be used for additional
// information, like type or symbol information.
Description *string `json:"description,omitempty"`
}
Additional details for a completion item label.
@since 3.17.0
type CompletionItemTag ¶
type CompletionItemTag int
Tags are extra annotations that tweak the rendering of a completion item.
@since 3.15.0
const ( // Render a completion as obsolete, usually using a strike-out. CompletionItemTagDeprecated CompletionItemTag = 1 )
type CompletionList ¶
type CompletionList struct {
// IsIncomplete indicates if the list is complete.
// If true, the client should re-trigger completion when typing more characters.
IsIncomplete bool `json:"isIncomplete"`
// Items contains the completion items.
Items []CompletionItem `json:"items"`
}
CompletionList represents a collection of completion items. It can be either a list of items or a flag indicating if further items can be resolved.
type CompletionOptions ¶
type CompletionOptions struct {
WorkDoneProgressOptions
// The additional characters, beyond the defaults provided by the client (typically
// [a-zA-Z]), that should automatically trigger a completion request. For example
// `.` in JavaScript represents the beginning of an object property or method and is
// thus a good candidate for triggering a completion request.
//
// Most tools trigger a 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.
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 client capability
// `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"`
// The server provides support to resolve additional
// information for a completion item.
ResolveProvider *bool `json:"resolveProvider,omitempty"`
// The server supports the following `CompletionItem` specific
// capabilities.
//
// @since 3.17.0
CompletionItem *CompletionItemCapability `json:"completionItem,omitempty"`
}
Completion options used during `initialize` or server capabilities registration.
type CompletionParams ¶
type CompletionParams struct {
TextDocumentPositionParams
WorkDoneProgressParams
PartialResultParams
// The completion context. This is only available if the client specifies to send this using the client capability `textDocument.completion.contextSupport === true`
Context *CompletionContext `json:"context,omitempty"`
}
Completion parameters.
type CompletionResponse ¶ added in v0.0.7
type CompletionResponse struct {
// When the result is a list of completion items.
Items []CompletionItem
// When the result is a completion list with additional metadata like isIncomplete.
List *CompletionList
// If null
Null bool
}
func (CompletionResponse) MarshalJSON ¶ added in v0.0.7
func (cr CompletionResponse) MarshalJSON() ([]byte, error)
MarshalJSON customizes the JSON encoding for CompletionResponse.
func (*CompletionResponse) UnmarshalJSON ¶ added in v0.0.7
func (cr *CompletionResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON customizes the JSON decoding for CompletionResponse.
type CompletionTriggerKind ¶
type CompletionTriggerKind int
How a completion was triggered.
const ( // Completion was triggered by typing an identifier (24x7 code complete), manual invocation (e.g Ctrl+Space) or via API. CompletionTriggerKindInvoked CompletionTriggerKind = 1 // Completion was triggered by a trigger character specified by the `triggerCharacters` properties of the `CompletionOptions`. CompletionTriggerKindTriggerCharacter CompletionTriggerKind = 2 // Completion was re-triggered as the current completion list is incomplete. CompletionTriggerKindTriggerForIncompleteCompletions CompletionTriggerKind = 3 )
type CreateFile ¶ added in v0.0.7
type CreateFile struct {
ResourceOperation
URI DocumentURI `json:"uri"`
Options *CreateFileOptions `json:"options,omitempty"`
}
CreateFile operation. See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#createFile
type CreateFileOptions ¶ added in v0.0.7
type CreateFileOptions struct {
// Overwrite existing file. Overwrite wins over ignoreIfExists.
Overwrite bool `json:"overwrite,omitempty"`
// Ignore if exists.
IgnoreIfExists bool `json:"ignoreIfExists,omitempty"`
}
Options to create a file. See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#createFileOptions
type DefinitionParams ¶
type DefinitionParams struct {
WorkDoneProgressParams
PartialResultParams
TextDocumentPositionParams
}
DefinitionParams defines the parameters for a textDocument/definition request.
type DefinitionResponse ¶
type DefinitionResponse struct {
Location *Location
LocationList []Location
LocationLinks []LocationLink
Null bool
}
DefinitionResponse represents the result of a textDocument/definition request.
It can be a single Location, a slice of Locations, a slice of LocationLinks or null.
func (DefinitionResponse) MarshalJSON ¶
func (dr DefinitionResponse) MarshalJSON() ([]byte, error)
func (*DefinitionResponse) UnmarshalJSON ¶ added in v0.0.7
func (dr *DefinitionResponse) UnmarshalJSON(data []byte) error
type DeleteFile ¶ added in v0.0.7
type DeleteFile struct {
ResourceOperation
URI DocumentURI `json:"uri"`
Options *DeleteFileOptions `json:"options,omitempty"`
}
DeleteFile operation. See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#deleteFile
type DeleteFileOptions ¶ added in v0.0.7
type DeleteFileOptions struct {
// Delete content recursively if a folder is denoted.
Recursive bool `json:"recursive,omitempty"`
// Ignore the operation if the file doesn't exist.
IgnoreIfNotExists bool `json:"ignoreIfNotExists,omitempty"`
}
Options to delete a file. See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#deleteFileOptions
type Diagnostic ¶
type Diagnostic struct {
// The range at which the message applies.
Range Range `json:"range"`
// The diagnostic's severity. To avoid interpretation mismatches when a
// server is used with different clients it is highly recommended that
// servers always provide a severity value. If omitted, it’s recommended
// for the client to interpret it as an Error severity.
Severity DiagnosticSeverity `json:"severity,omitempty"`
// The diagnostic's code, which might appear in the user interface.
Code any `json:"code,omitempty"` // integer or string
// An optional property to describe the error code.
//
// @since 3.16.0
CodeDescription *CodeDescription `json:"codeDescription,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"`
// A data entry field that is preserved between
// a `textDocument/publishDiagnostics` notification and
// `textDocument/codeAction` request.
//
// @since 3.16.0
Data LSPAny `json:"data,omitempty"`
}
Represents a diagnostic, such as a compiler error or warning. See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnostic
type DiagnosticOptions ¶
type DiagnosticOptions struct {
WorkDoneProgressOptions
// An optional identifier under which the diagnostics are
// managed by the client.
Identifier string `json:"identifier,omitempty"`
// Whether the language has inter file dependencies meaning that
// editing code in one file can result in a different diagnostic
// set in another file. Inter file dependencies are common for
// most programming languages and typically uncommon for linters.
InterFileDependencies bool `json:"interFileDependencies"`
// The server provides support for workspace diagnostics as well.
WorkspaceDiagnostics bool `json:"workspaceDiagnostics"`
}
Diagnostic registration options to configure pull diagnostics.
@since 3.17.0
type DiagnosticRelatedInformation ¶
type DiagnosticRelatedInformation struct {
// The location of this related diagnostic information.
Location Location `json:"location"`
// The message of this related diagnostic information.
Message string `json:"message"`
}
Represents a related message and source code location for a diagnostic.
type DiagnosticSeverity ¶
type DiagnosticSeverity int
The severity of a diagnostic message.
const ( // Reports an error. DiagnosticSeverityError DiagnosticSeverity = 1 // Reports a warning. DiagnosticSeverityWarning DiagnosticSeverity = 2 // Reports an information. DiagnosticSeverityInformation DiagnosticSeverity = 3 // Reports a hint. DiagnosticSeverityHint DiagnosticSeverity = 4 )
type DiagnosticTag ¶
type DiagnosticTag int
Additional metadata about a diagnostic.
@since 3.15.0
const ( // Unused or unnecessary code. // Clients are allowed to render diagnostics with this tag faded out instead of having // an error squiggle. DiagnosticTagUnnecessary DiagnosticTag = 1 // Deprecated or obsolete code. // Clients are allowed to rendered diagnostics with this tag strike-through. DiagnosticTagDeprecated DiagnosticTag = 2 )
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
// receive them.
// - apply the `TextDocumentContentChangeEvent`s in a single notification
// in the order you receive them.
ContentChanges []TextDocumentContentChangeEvent `json:"contentChanges"`
}
The parameters sent in a didChange notification.
@since 3.0.0
type DidCloseTextDocumentParams ¶
type DidCloseTextDocumentParams struct {
// The document that was closed.
TextDocument TextDocumentIdentifier `json:"textDocument"`
}
The parameters sent in a didClose notification.
@since 3.0.0
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"`
}
The parameters sent in a didSave notification.
@since 3.0.0
type DocumentChangeOperation ¶ added in v0.0.7
type DocumentChangeOperation interface {
// contains filtered or unexported methods
}
DocumentChangeOperation represents any valid document change operation.
type DocumentDiagnosticParams ¶
type DocumentDiagnosticParams struct {
WorkDoneProgressParams
PartialResultParams
// The text document to request diagnostics for.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// The additional identifier provided during registration.
Identifier string `json:"identifier,omitempty"`
// The current version of the document.
// If provided, servers can avoid computing diagnostics again if the document version hasn’t changed.
PreviousResultID string `json:"previousResultId,omitempty"`
}
Parameters of the document diagnostic request.
@since 3.17.0
type DocumentDiagnosticReport ¶
type DocumentDiagnosticReport struct {
Full *FullDocumentDiagnosticReport
Unchanged *UnchangedDocumentDiagnosticReport
}
DocumentDiagnosticReport is either a full or an unchanged diagnostic report.
@since 3.17.0 See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#documentDiagnosticReport
func (DocumentDiagnosticReport) MarshalJSON ¶ added in v0.0.7
func (r DocumentDiagnosticReport) MarshalJSON() ([]byte, error)
func (*DocumentDiagnosticReport) UnmarshalJSON ¶ added in v0.0.7
func (r *DocumentDiagnosticReport) UnmarshalJSON(data []byte) error
type DocumentURI ¶ added in v0.0.7
type DocumentURI string
A URI for a document. This is just a string alias, typically a `file://` or other scheme URI.
type FullDocumentDiagnosticReport ¶
type FullDocumentDiagnosticReport struct {
Kind string `json:"kind"` // Should always be "full"
ResultID string `json:"resultId,omitempty"`
Items []Diagnostic `json:"items"`
}
A full diagnostic report with a full set of problems.
@since 3.17.0
type Hover ¶ added in v0.0.7
type Hover struct {
// The hover's content.
Contents MarkupContentOrMarkedString `json:"contents"`
// An optional range inside the text document that is used to
// visualize the hover, e.g. by changing the background color.
Range *Range `json:"range,omitempty"`
}
The result of a hover request.
@since 3.0.0
See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#hover
type HoverParams ¶
type HoverParams struct {
TextDocumentPositionParams
WorkDoneProgressParams
}
Parameters for a textDocument/hover request.
@since 3.0.0
type HoverResult ¶
The result of a textDocument/hover request.
Can be a Hover object or null.
See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#hover
func (HoverResult) MarshalJSON ¶ added in v0.0.7
func (h HoverResult) MarshalJSON() ([]byte, error)
func (*HoverResult) UnmarshalJSON ¶ added in v0.0.7
func (h *HoverResult) UnmarshalJSON(data []byte) error
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.
ProcessID *int `json:"processId,omitempty"`
// The information about the client.
//
// @since 3.15.0
ClientInfo *ClientInfo `json:"clientInfo,omitempty"`
// The locale the client is currently showing the user interface in.
// This must not be used to influence the content of hover, completion, signature help etc.
//
// @since 3.16.0
Locale *string `json:"locale,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 DocumentURI `json:"rootUri,omitempty"`
// User provided initialization options.
InitializationOptions LSPAny `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 *TraceValue `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.
//
// @since 3.6.0
WorkspaceFolders []WorkspaceFolder `json:"workspaceFolders,omitempty"`
}
The initialize parameters.
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"`
}
The result returned from an initialize request.
type InsertTextFormat ¶
type InsertTextFormat int
Defines how the insert text in a completion item is interpreted.
const ( // The primary text to be inserted is treated as a plain string. InsertTextFormatPlainText InsertTextFormat = 1 // 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. InsertTextFormatSnippet InsertTextFormat = 2 )
type InsertTextMode ¶
type InsertTextMode int
How whitespace and indentation is handled during completion item insertion.
@since 3.16.0
const ( // The insertion or replace strings is taken as it is. If the // value is multi line the lines below the cursor will be // inserted using the indentation defined in the string value. // The client will not apply any kind of adjustments to the // string. InsertTextModeAsIs InsertTextMode = 1 // The editor adjusts leading whitespace of new lines so that // they match the indentation up to the cursor of the line for // which the item is accepted. // // Consider a line like this: <2tabs><cursor><3tabs>foo. Accepting a // multi line completion item is indented using 2 tabs and all // following lines inserted will be indented using 2 tabs as well. InsertTextModeAdjustIndentation InsertTextMode = 2 )
type LSPAny ¶ added in v0.0.7
type LSPAny = any
The LSP any type It can be a primitive (string, number, boolean, null), an object, or an array.
See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#lspAny
@since 3.17.0
type LanguageID ¶
type LanguageID string
A language id represented as a string.
const ( // LanguagePHP is the identifier for PHP documents. LanguagePHP LanguageID = "php" // LanguageBlade is the identifier for blade documents. LanguageBlade LanguageID = "blade" )
type Location ¶
type Location struct {
// URI of the document.
URI DocumentURI `json:"uri"`
// The range within the document.
Range Range `json:"range"`
}
Represents a location inside a resource, such as a line inside a text file.
See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#location
type LocationLink ¶
type LocationLink struct {
// Span of the origin of this link.
// Used as the underlined span for mouse interaction.
// Clients should omit this property if the origin selection range is not applicable.
OriginSelectionRange *Range `json:"originSelectionRange,omitempty"`
// The target resource identifier.
TargetURI DocumentURI `json:"targetUri"`
// 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"`
// 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 `targetRange`. See also `DocumentSymbol#range`.
TargetSelectionRange Range `json:"targetSelectionRange"`
}
Represents a link between a source and a target location.
@since 3.14.0
type MarkedString ¶
type MarkedString struct {
Language string `json:"language,omitempty"`
Value string `json:"value"`
}
MarkedString can be used to render human-readable text, optionally with a language hint.
@since 3.0.0
type MarkupContent ¶
type MarkupContent struct {
Kind MarkupKind `json:"kind"`
Value string `json:"value"` // actual content
}
MarkupContent represents a string value with optional markup kind.
@since 3.0.0
type MarkupContentOrMarkedString ¶ added in v0.0.7
type MarkupContentOrMarkedString struct {
Markup *MarkupContent
MarkedString *MarkedString
MarkedStrings []MarkedString
}
func (MarkupContentOrMarkedString) MarshalJSON ¶ added in v0.0.7
func (m MarkupContentOrMarkedString) MarshalJSON() ([]byte, error)
func (*MarkupContentOrMarkedString) UnmarshalJSON ¶ added in v0.0.7
func (m *MarkupContentOrMarkedString) UnmarshalJSON(data []byte) error
type MarkupKind ¶ added in v0.0.7
type MarkupKind string
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 ( // Plain text is supported as a content format MarkupKindPlainText MarkupKind = "plaintext" // Markdown is supported as a content format MarkupKindMarkdown MarkupKind = "markdown" )
type PartialResultParams ¶
type PartialResultParams struct {
// PartialResultToken is a token for handling partial result updates.
PartialResultToken *ProgressToken `json:"partialResultToken,omitempty"`
}
PartialResultParams allows for partial results in responses.
type Position ¶
type Position struct {
// Line position in a document (zero-based).
Line uint32 `json:"line"`
// Character offset on a line in a document (zero-based).
//
// The meaning of this offset is determined by the negotiated
// `PositionEncodingKind`.
Character uint32 `json:"character"`
}
Position in a text document expressed as zero-based line and character offset.
See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#position
type PositionEncodingKind ¶ added in v0.0.7
type PositionEncodingKind string
A set of predefined position encoding kinds.
@since 3.17.0
const ( // Character offsets count UTF-8 code units. PositionEncodingKindUTF8 PositionEncodingKind = "utf-8" // Character offsets count UTF-16 code units. // This is the default and must always be supported by servers PositionEncodingKindUTF16 PositionEncodingKind = "utf-16" // Character offsets count UTF-32 code units. // Implementation note: these are the same as Unicode code points, // so this `PositionEncodingKind` may also be used for an // encoding-agnostic representation of character offsets. PositionEncodingKindUTF32 PositionEncodingKind = "utf-32" )
type ProgressToken ¶
type ProgressToken struct {
// contains filtered or unexported fields
}
A token that can be used to report work done progress. Can be a string or a number.
See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#progress
func (*ProgressToken) MarshalJSON ¶
func (v *ProgressToken) MarshalJSON() ([]byte, error)
func (*ProgressToken) UnmarshalJSON ¶
func (v *ProgressToken) UnmarshalJSON(data []byte) error
type Range ¶
type Range struct {
// The range's start position.
Start Position `json:"start"`
// The range's end position.
End Position `json:"end"`
}
A range in a text document expressed as (zero-based) start and end positions. A range is comparable to a selection in an editor. Therefore, the end position is exclusive. 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.
See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#range
type RenameFile ¶ added in v0.0.7
type RenameFile struct {
ResourceOperation
OldURI DocumentURI `json:"oldUri"`
NewURI DocumentURI `json:"newUri"`
Options *RenameFileOptions `json:"options,omitempty"`
}
RenameFile operation. See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#renameFile
type RenameFileOptions ¶ added in v0.0.7
type RenameFileOptions struct {
// Overwrite target if existing.
Overwrite bool `json:"overwrite,omitempty"`
// Ignores if target exists.
IgnoreIfExists bool `json:"ignoreIfExists,omitempty"`
}
Options to rename a file. See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#renameFileOptions
type ResourceOperation ¶ added in v0.0.7
type ResourceOperation struct {
// resource operation kind
Kind string `json:"kind"`
// An optional annotation identifier describing the operation.
AnnotationID string `json:"annotationId,omitempty"`
}
A generic resource operation.
type ServerCapabilities ¶
type ServerCapabilities struct {
// The position encoding the server picked from the encodings offered
// by the client via the client capability `general.positionEncodings`.
//
// If the client didn't provide any position encodings the only valid
// value that a server can return is 'utf-16'.
//
// If omitted it defaults to 'utf-16'.
//
// @since 3.17.0
PositionEncoding *PositionEncodingKind `json:"positionEncoding,omitempty"`
// 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`.
TextDocumentSync any `json:"textDocumentSync,omitempty"` // *TextDocumentSyncOptions | TextDocumentSyncKind
// The server provides completion support.
CompletionProvider *CompletionOptions `json:"completionProvider,omitempty"`
// The server provides hover support.
HoverProvider bool `json:"hoverProvider,omitempty"`
// The server provides signature help support.
SignatureHelpProvider *SignatureHelpOptions `json:"signatureHelpProvider,omitempty"`
// The server provides goto definition support.
DefinitionProvider bool `json:"definitionProvider,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`.
CodeActionProvider bool `json:"codeActionProvider,omitempty"`
// The server has support for pull model diagnostics.
//
// @since 3.17.0
DiagnosticProvider any `json:"diagnosticProvider,omitempty"` // DiagnosticOptions | DiagnosticRegistrationOptions
// Experimental server capabilities.
Experimental *LSPAny `json:"experimental,omitempty"`
}
ServerCapabilities defines the capabilities of the language server.
type ServerInfo ¶
type ServerInfo struct {
// The name of the server as defined by the server.
Name string `json:"name"`
// The server's version, if provided.
Version string `json:"version,omitempty"`
}
The server info returned from an initialize request.
@since 3.15.0
type SignatureHelpOptions ¶
type SignatureHelpOptions struct {
// The characters that trigger signature help automatically.
TriggerCharacters []string `json:"triggerCharacters,omitempty"`
// List of characters that re-trigger signature help.
// These are typically the same as `triggerCharacters`, but may contain additional characters.
// @since 3.2.0
RetriggerCharacters []string `json:"retriggerCharacters,omitempty"`
}
Server capabilities for signature help requests.
type TextDocumentContentChangeEvent ¶
type TextDocumentContentChangeEvent struct {
// The range of the document that changed.
Range *Range `json:"range,omitempty"`
// The optional length of the range that got replaced.
// Deprecated: use range instead.
RangeLength *uint `json:"rangeLength,omitempty"`
// The new text of the document.
Text string `json:"text"`
}
An event describing a change to a text document. If range and rangeLength are omitted, the new text is considered the full content.
@since 3.0.0
type TextDocumentEdit ¶
type TextDocumentEdit struct {
// TextDocument identifies the text document to change.
TextDocument VersionedTextDocumentIdentifier `json:"textDocument"`
// Edits is an array of edits to apply to the text document.
Edits []TextEdit `json:"edits"`
}
TextDocumentEdit represents edits to a single text document.
type TextDocumentIdentifier ¶
type TextDocumentIdentifier struct {
// URI is the unique resource identifier of the document that was closed.
URI string `json:"uri"`
}
TextDocumentIdentifier is used to identify a specific text document. It only contains the URI of the document.
type TextDocumentItem ¶
type TextDocumentItem struct {
// URI is the unique resource identifier of the document (usually a file path or URL).
URI string `json:"uri"`
// LanguageID is the language identifier associated with the document (e.g., "python", "javascript").
LanguageID LanguageID `json:"languageId"`
// Version is the version number of the document.
Version int `json:"version"`
// Text is the content of the document.
Text string `json:"text"`
}
TextDocumentItem represents the information related to a text document.
type TextDocumentPositionParams ¶
type TextDocumentPositionParams struct {
// TextDocument holds the identifier of the text document.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// Position specifies the position within the text document.
Position Position `json:"position"`
}
TextDocumentPositionParams represents parameters for requests that operate on a specific text document at a specific position, such as hover information or code actions.
type TextDocumentSyncKind ¶
type TextDocumentSyncKind int
Defines how the host (editor) should sync document changes to the language server.
const ( // Documents should not be synced at all. TextDocumentSyncKindNone TextDocumentSyncKind = 0 // Documents are synced by always sending the full content of the document. TextDocumentSyncKindFull TextDocumentSyncKind = 1 // Documents are synced by sending the full content on open and close. // After that only incremental updates to the document are sent. TextDocumentSyncKindIncremental TextDocumentSyncKind = 2 )
type TextEdit ¶
type TextEdit struct {
// 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"`
// The string to be inserted. For delete operations use an empty string.
NewText string `json:"newText"`
}
A text edit applicable to a text document.
See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textEdit
type TraceValue ¶
type TraceValue string
The LSP allows the client to control the tracing of the server.
const ( // No tracing. TraceValueOff TraceValue = "off" // Messages only. TraceValueMessages TraceValue = "messages" // Verbose message logging. TraceValueVerbose TraceValue = "verbose" )
type UnchangedDocumentDiagnosticReport ¶ added in v0.0.7
type UnchangedDocumentDiagnosticReport struct {
Kind string `json:"kind"` // Should always be "unchanged"
ResultID string `json:"resultId"`
}
An unchanged diagnostic report indicating nothing has changed.
@since 3.17.0
type VersionedTextDocumentIdentifier ¶
type VersionedTextDocumentIdentifier struct {
TextDocumentIdentifier
// Version is the version number of the document.
Version int `json:"version"`
}
VersionedTextDocumentIdentifier identifies a versioned text document.
type WorkDoneProgressOptions ¶
type WorkDoneProgressOptions struct {
// WorkDoneProgress is a flag that indicates whether progress reporting is supported.
WorkDoneProgress bool `json:"workDoneProgress,omitempty"`
}
WorkDoneProgressOptions indicates if a request supports work-done progress reporting.
type WorkDoneProgressParams ¶
type WorkDoneProgressParams struct {
// WorkDoneToken an optional token that a server can use to report work done progress.
WorkDoneToken *ProgressToken `json:"workDoneToken,omitempty"`
}
WorkDoneProgressParams is a parameter property of report work done progress.
type WorkspaceEdit ¶
type WorkspaceEdit struct {
// Holds changes to existing resources.
// Each entry describes edits to a single document.
Changes map[DocumentURI][]TextEdit `json:"changes,omitempty"`
// Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes are either
// an array of `TextDocumentEdit`s or a mix of `TextDocumentEdit`, `CreateFile`, `RenameFile`, and `DeleteFile` operations.
//
// Changes to existing files are described with `TextDocumentEdit`.
// Changes to the workspace are described with resource operations like `RenameFile`, `CreateFile`, and `DeleteFile`.
//
// @since 3.13.0
DocumentChanges []DocumentChangeOperation `json:"documentChanges,omitempty"`
// A map of change annotations that can be referenced in `AnnotatedTextEdit`s or create, rename and delete file operations.
//
// @since 3.16.0
ChangeAnnotations map[string]ChangeAnnotation `json:"changeAnnotations,omitempty"`
}
A workspace edit represents changes to many resources managed in the workspace. The edit should either provide `changes` or `documentChanges`. If the client can handle versioned document edits and if `documentChanges` are present, the latter are preferred over `changes`.
type WorkspaceFolder ¶ added in v0.0.7
type WorkspaceFolder struct {
// The associated URI for this workspace folder.
URI DocumentURI `json:"uri"`
// The name of the workspace folder. Used to refer to this
// workspace folder in the user interface.
Name string `json:"name"`
}
A workspace folder inside a client.
@since 3.6.0