Documentation ¶
Overview ¶
Package lsp contains Go types for the messages used in the Language Server Protocol.
See https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md for more information.
Index ¶
- Constants
- type CancelParams
- type ClientCapabilities
- type CodeActionContext
- type CodeActionParams
- type CodeLens
- type CodeLensOptions
- type CodeLensParams
- type Command
- type CompletionContext
- type CompletionItem
- type CompletionItemKind
- type CompletionList
- type CompletionOptions
- type CompletionParams
- type CompletionTriggerKind
- type ConfigurationItem
- type ConfigurationParams
- type ConfigurationResult
- type Diagnostic
- type DiagnosticSeverity
- type DidChangeConfigurationParams
- type DidChangeTextDocumentParams
- type DidChangeWatchedFilesParams
- type DidCloseTextDocumentParams
- type DidOpenTextDocumentParams
- type DidSaveTextDocumentParams
- type DocumentFormattingParams
- type DocumentHighlight
- type DocumentHighlightKind
- type DocumentOnTypeFormattingOptions
- type DocumentOnTypeFormattingParams
- type DocumentRangeFormattingParams
- type DocumentSymbolParams
- type DocumentURI
- type ExecuteCommandOptions
- type ExecuteCommandParams
- type FileChangeType
- type FileEvent
- type FormattingOptions
- type Hover
- type ID
- type InitializeError
- type InitializeParams
- type InitializeResult
- type InsertTextFormat
- type Location
- type LogMessageParams
- type MarkedString
- type MessageActionItem
- type MessageType
- type None
- type ParameterInformation
- type Position
- type PublishDiagnosticsParams
- type Range
- type ReferenceContext
- type ReferenceParams
- type RenameParams
- type SaveOptions
- type ServerCapabilities
- type ShowMessageParams
- type ShowMessageRequestParams
- type SignatureHelp
- type SignatureHelpOptions
- type SignatureInformation
- type SymbolInformation
- type SymbolKind
- type TextDocumentClientCapabilities
- type TextDocumentContentChangeEvent
- type TextDocumentIdentifier
- type TextDocumentItem
- type TextDocumentPositionParams
- type TextDocumentSyncKind
- type TextDocumentSyncOptions
- type TextDocumentSyncOptionsOrKind
- type TextEdit
- type VersionedTextDocumentIdentifier
- type WorkspaceClientCapabilities
- type WorkspaceEdit
- type WorkspaceSymbolParams
Constants ¶
const ( Text DocumentHighlightKind = 1 Read = 2 Write = 3 )
const ( MTError MessageType = 1 MTWarning = 2 Info = 3 Log = 4 )
const ( Created FileChangeType = 1 Changed = 2 Deleted = 3 )
const ( Error DiagnosticSeverity = 1 Warning = 2 Information = 3 Hint = 4 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CancelParams ¶
type CancelParams struct {
ID ID `json:"id"`
}
type ClientCapabilities ¶
type ClientCapabilities struct { Workspace WorkspaceClientCapabilities `json:"workspace,omitempty"` TextDocument TextDocumentClientCapabilities `json:"textDocument,omitempty"` Experimental interface{} `json:"experimental,omitempty"` // XFilesProvider indicates the client provides support for // workspace/xfiles. This is a Sourcegraph extension. XFilesProvider bool `json:"xfilesProvider,omitempty"` // XContentProvider indicates the client provides support for // textDocument/xcontent. This is a Sourcegraph extension. XContentProvider bool `json:"xcontentProvider,omitempty"` // XCacheProvider indicates the client provides support for cache/get // and cache/set. XCacheProvider bool `json:"xcacheProvider,omitempty"` }
type CodeActionContext ¶
type CodeActionContext struct {
Diagnostics []Diagnostic `json:"diagnostics"`
}
type CodeActionParams ¶
type CodeActionParams struct { TextDocument TextDocumentIdentifier `json:"textDocument"` Range Range `json:"range"` Context CodeActionContext `json:"context"` }
type CodeLensOptions ¶
type CodeLensOptions struct {
ResolveProvider bool `json:"resolveProvider,omitempty"`
}
type CodeLensParams ¶
type CodeLensParams struct {
TextDocument TextDocumentIdentifier `json:"textDocument"`
}
type CompletionContext ¶
type CompletionContext struct { TriggerKind CompletionTriggerKind `json:"triggerKind"` TriggerCharacter string `json:"triggerCharacter,omitempty"` }
type CompletionItem ¶
type CompletionItem struct { Label string `json:"label"` Kind CompletionItemKind `json:"kind,omitempty"` Detail string `json:"detail,omitempty"` Documentation string `json:"documentation,omitempty"` SortText string `json:"sortText,omitempty"` FilterText string `json:"filterText,omitempty"` InsertText string `json:"insertText,omitempty"` InsertTextFormat InsertTextFormat `json:"insertTextFormat,omitempty"` TextEdit *TextEdit `json:"textEdit,omitempty"` Data interface{} `json:"data,omitempty"` }
type CompletionItemKind ¶
type CompletionItemKind int
const ( CIKText CompletionItemKind CIKMethod CIKFunction CIKConstructor CIKField CIKVariable CIKClass CIKInterface CIKModule CIKProperty CIKUnit CIKValue CIKEnum CIKKeyword CIKSnippet CIKColor CIKFile CIKReference CIKFolder CIKEnumMember CIKConstant CIKStruct CIKEvent CIKOperator CIKTypeParameter )
func (CompletionItemKind) String ¶
func (c CompletionItemKind) String() string
type CompletionList ¶
type CompletionList struct { IsIncomplete bool `json:"isIncomplete"` Items []CompletionItem `json:"items"` }
type CompletionOptions ¶
type CompletionParams ¶
type CompletionParams struct { TextDocumentPositionParams Context CompletionContext `json:"context,omitempty"` }
type CompletionTriggerKind ¶
type CompletionTriggerKind int
const ( CTKInvoked CompletionTriggerKind = 1 CTKTriggerCharacter = 2 )
type ConfigurationItem ¶
type ConfigurationParams ¶
type ConfigurationParams struct {
Items []ConfigurationItem `json:"items"`
}
type ConfigurationResult ¶
type ConfigurationResult []interface{}
type Diagnostic ¶
type Diagnostic struct { /** * The range at which the message applies. */ Range 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. Can be omitted. */ 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"` }
type DiagnosticSeverity ¶
type DiagnosticSeverity int
type DidChangeConfigurationParams ¶
type DidChangeConfigurationParams struct {
Settings interface{} `json:"settings"`
}
type DidChangeTextDocumentParams ¶
type DidChangeTextDocumentParams struct { TextDocument VersionedTextDocumentIdentifier `json:"textDocument"` ContentChanges []TextDocumentContentChangeEvent `json:"contentChanges"` }
type DidChangeWatchedFilesParams ¶
type DidChangeWatchedFilesParams struct {
Changes []FileEvent `json:"changes"`
}
type DidCloseTextDocumentParams ¶
type DidCloseTextDocumentParams struct {
TextDocument TextDocumentIdentifier `json:"textDocument"`
}
type DidOpenTextDocumentParams ¶
type DidOpenTextDocumentParams struct {
TextDocument TextDocumentItem `json:"textDocument"`
}
type DidSaveTextDocumentParams ¶
type DidSaveTextDocumentParams struct {
TextDocument TextDocumentIdentifier `json:"textDocument"`
}
type DocumentFormattingParams ¶
type DocumentFormattingParams struct { TextDocument TextDocumentIdentifier `json:"textDocument"` Options FormattingOptions `json:"options"` }
type DocumentHighlight ¶
type DocumentHighlightKind ¶
type DocumentHighlightKind int
type DocumentOnTypeFormattingParams ¶
type DocumentOnTypeFormattingParams struct { TextDocument TextDocumentIdentifier `json:"textDocument"` Position Position `json:"position"` Ch string `json:"ch"` Options FormattingOptions `json:"formattingOptions"` }
type DocumentRangeFormattingParams ¶
type DocumentRangeFormattingParams struct { TextDocument TextDocumentIdentifier `json:"textDocument"` Range Range `json:"range"` Options FormattingOptions `json:"options"` }
type DocumentSymbolParams ¶
type DocumentSymbolParams struct {
TextDocument TextDocumentIdentifier `json:"textDocument"`
}
type DocumentURI ¶
type DocumentURI string
type ExecuteCommandOptions ¶
type ExecuteCommandOptions struct {
Commands []string `json:"commands"`
}
type ExecuteCommandParams ¶
type ExecuteCommandParams struct { Command string `json:"command"` Arguments []interface{} `json:"arguments,omitempty"` }
type FileChangeType ¶
type FileChangeType int
type FileEvent ¶
type FileEvent struct { URI DocumentURI `json:"uri"` Type int `json:"type"` }
type FormattingOptions ¶
type Hover ¶
type Hover struct { Contents []MarkedString `json:"contents"` Range *Range `json:"range,omitempty"` }
func (Hover) MarshalJSON ¶
type ID ¶
type ID struct { // At most one of Num or Str may be nonzero. If both are zero // valued, then IsNum specifies which field's value is to be used // as the ID. Num uint64 Str string // IsString controls whether the Num or Str field's value should be // used as the ID, when both are zero valued. It must always be // set to true if the request ID is a string. IsString bool }
ID represents a JSON-RPC 2.0 request ID, which may be either a string or number (or null, which is unsupported).
func (ID) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*ID) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type InitializeError ¶
type InitializeError struct {
Retry bool `json:"retry"`
}
type InitializeParams ¶
type InitializeParams struct { ProcessID int `json:"processId,omitempty"` // RootPath is DEPRECATED in favor of the RootURI field. RootPath string `json:"rootPath,omitempty"` RootURI DocumentURI `json:"rootUri,omitempty"` InitializationOptions interface{} `json:"initializationOptions,omitempty"` Capabilities ClientCapabilities `json:"capabilities"` }
func (*InitializeParams) Root ¶
func (p *InitializeParams) Root() DocumentURI
Root returns the RootURI if set, or otherwise the RootPath with 'file://' prepended.
type InitializeResult ¶
type InitializeResult struct {
Capabilities ServerCapabilities `json:"capabilities,omitempty"`
}
type InsertTextFormat ¶
type InsertTextFormat int
const ( ITFPlainText InsertTextFormat = 1 ITFSnippet = 2 )
type Location ¶
type Location struct { URI DocumentURI `json:"uri"` Range Range `json:"range"` }
type LogMessageParams ¶
type LogMessageParams struct { Type MessageType `json:"type"` Message string `json:"message"` }
type MarkedString ¶
type MarkedString markedString
func RawMarkedString ¶
func RawMarkedString(s string) MarkedString
RawMarkedString returns a MarkedString consisting of only a raw string (i.e., "foo" instead of {"value":"foo", "language":"bar"}).
func (MarkedString) MarshalJSON ¶
func (m MarkedString) MarshalJSON() ([]byte, error)
func (*MarkedString) UnmarshalJSON ¶
func (m *MarkedString) UnmarshalJSON(data []byte) error
type MessageActionItem ¶
type MessageActionItem struct {
Title string `json:"title"`
}
type MessageType ¶
type MessageType int
type ParameterInformation ¶
type Position ¶
type PublishDiagnosticsParams ¶
type PublishDiagnosticsParams struct { URI DocumentURI `json:"uri"` Diagnostics []Diagnostic `json:"diagnostics"` }
type Range ¶
type ReferenceContext ¶
type ReferenceParams ¶
type ReferenceParams struct { TextDocumentPositionParams Context ReferenceContext `json:"context"` }
type RenameParams ¶
type RenameParams struct { TextDocument TextDocumentIdentifier `json:"textDocument"` Position Position `json:"position"` NewName string `json:"newName"` }
type SaveOptions ¶
type SaveOptions struct {
IncludeText bool `json:"includeText"`
}
type ServerCapabilities ¶
type ServerCapabilities struct { TextDocumentSync *TextDocumentSyncOptionsOrKind `json:"textDocumentSync,omitempty"` HoverProvider bool `json:"hoverProvider,omitempty"` CompletionProvider *CompletionOptions `json:"completionProvider,omitempty"` SignatureHelpProvider *SignatureHelpOptions `json:"signatureHelpProvider,omitempty"` DefinitionProvider bool `json:"definitionProvider,omitempty"` TypeDefinitionProvider bool `json:"typeDefinitionProvider,omitempty"` ReferencesProvider bool `json:"referencesProvider,omitempty"` DocumentHighlightProvider bool `json:"documentHighlightProvider,omitempty"` DocumentSymbolProvider bool `json:"documentSymbolProvider,omitempty"` WorkspaceSymbolProvider bool `json:"workspaceSymbolProvider,omitempty"` ImplementationProvider bool `json:"implementationProvider,omitempty"` CodeActionProvider bool `json:"codeActionProvider,omitempty"` CodeLensProvider *CodeLensOptions `json:"codeLensProvider,omitempty"` DocumentFormattingProvider bool `json:"documentFormattingProvider,omitempty"` DocumentRangeFormattingProvider bool `json:"documentRangeFormattingProvider,omitempty"` DocumentOnTypeFormattingProvider *DocumentOnTypeFormattingOptions `json:"documentOnTypeFormattingProvider,omitempty"` RenameProvider bool `json:"renameProvider,omitempty"` ExecuteCommandProvider *ExecuteCommandOptions `json:"executeCommandProvider,omitempty"` // XWorkspaceReferencesProvider indicates the server provides support for // xworkspace/references. This is a Sourcegraph extension. XWorkspaceReferencesProvider bool `json:"xworkspaceReferencesProvider,omitempty"` // XDefinitionProvider indicates the server provides support for // textDocument/xdefinition. This is a Sourcegraph extension. XDefinitionProvider bool `json:"xdefinitionProvider,omitempty"` // XWorkspaceSymbolByProperties indicates the server provides support for // querying symbols by properties with WorkspaceSymbolParams.symbol. This // is a Sourcegraph extension. XWorkspaceSymbolByProperties bool `json:"xworkspaceSymbolByProperties,omitempty"` Experimental interface{} `json:"experimental,omitempty"` }
type ShowMessageParams ¶
type ShowMessageParams struct { Type MessageType `json:"type"` Message string `json:"message"` }
type ShowMessageRequestParams ¶
type ShowMessageRequestParams struct { Type MessageType `json:"type"` Message string `json:"message"` Actions []MessageActionItem `json:"actions"` }
type SignatureHelp ¶
type SignatureHelp struct { Signatures []SignatureInformation `json:"signatures"` ActiveSignature int `json:"activeSignature"` ActiveParameter int `json:"activeParameter"` }
type SignatureHelpOptions ¶
type SignatureHelpOptions struct {
TriggerCharacters []string `json:"triggerCharacters,omitempty"`
}
type SignatureInformation ¶
type SignatureInformation struct { Label string `json:"label"` Documentation string `json:"documentation,omitempty"` Parameters []ParameterInformation `json:"parameters,omitempty"` }
type SymbolInformation ¶
type SymbolInformation struct { Name string `json:"name"` Kind SymbolKind `json:"kind"` Location Location `json:"location"` ContainerName string `json:"containerName,omitempty"` }
type SymbolKind ¶
type SymbolKind int
const ( SKFile SymbolKind = 1 SKModule SymbolKind = 2 SKNamespace SymbolKind = 3 SKPackage SymbolKind = 4 SKClass SymbolKind = 5 SKMethod SymbolKind = 6 SKProperty SymbolKind = 7 SKField SymbolKind = 8 SKConstructor SymbolKind = 9 SKEnum SymbolKind = 10 SKInterface SymbolKind = 11 SKFunction SymbolKind = 12 SKVariable SymbolKind = 13 SKConstant SymbolKind = 14 SKString SymbolKind = 15 SKNumber SymbolKind = 16 SKBoolean SymbolKind = 17 SKArray SymbolKind = 18 SKObject SymbolKind = 19 SKKey SymbolKind = 20 SKNull SymbolKind = 21 SKEnumMember SymbolKind = 22 SKStruct SymbolKind = 23 SKEvent SymbolKind = 24 SKOperator SymbolKind = 25 SKTypeParameter SymbolKind = 26 )
The SymbolKind values are defined at https://microsoft.github.io/language-server-protocol/specification.
func (SymbolKind) String ¶
func (s SymbolKind) String() string
type TextDocumentClientCapabilities ¶
type TextDocumentClientCapabilities struct { Completion struct { CompletionItemKind struct { ValueSet []CompletionItemKind `json:"valueSet,omitempty"` } `json:"completionItemKind,omitempty"` CompletionItem struct { SnippetSupport bool `json:"snippetSupport,omitempty"` } `json:"completionItem,omitempty"` } `json:"completion,omitempty"` Implementation *struct { DynamicRegistration bool `json:"dynamicRegistration,omitempty"` } `json:"implementation,omitempty"` }
type TextDocumentIdentifier ¶
type TextDocumentIdentifier struct { /** * The text document's URI. */ URI DocumentURI `json:"uri"` }
type TextDocumentItem ¶
type TextDocumentItem struct { /** * The text document's URI. */ URI DocumentURI `json:"uri"` /** * The text document's language identifier. */ LanguageID string `json:"languageId"` /** * The version number of this document (it will strictly increase after each * change, including undo/redo). */ Version int `json:"version"` /** * The content of the opened text document. */ Text string `json:"text"` }
type TextDocumentPositionParams ¶
type TextDocumentPositionParams struct { /** * The text document. */ TextDocument TextDocumentIdentifier `json:"textDocument"` /** * The position inside the text document. */ Position Position `json:"position"` }
type TextDocumentSyncKind ¶
type TextDocumentSyncKind int
TextDocumentSyncKind is a DEPRECATED way to describe how text document syncing works. Use TextDocumentSyncOptions instead (or the Options field of TextDocumentSyncOptionsOrKind if you need to support JSON-(un)marshaling both).
const ( TDSKNone TextDocumentSyncKind = 0 TDSKFull TextDocumentSyncKind = 1 TDSKIncremental TextDocumentSyncKind = 2 )
type TextDocumentSyncOptions ¶
type TextDocumentSyncOptions struct { OpenClose bool `json:"openClose,omitempty"` Change TextDocumentSyncKind `json:"change"` WillSave bool `json:"willSave,omitempty"` WillSaveWaitUntil bool `json:"willSaveWaitUntil,omitempty"` Save *SaveOptions `json:"save,omitempty"` }
type TextDocumentSyncOptionsOrKind ¶
type TextDocumentSyncOptionsOrKind struct { Kind *TextDocumentSyncKind Options *TextDocumentSyncOptions }
TextDocumentSyncOptions holds either a TextDocumentSyncKind or TextDocumentSyncOptions. The LSP API allows either to be specified in the (ServerCapabilities).TextDocumentSync field.
func (*TextDocumentSyncOptionsOrKind) MarshalJSON ¶
func (v *TextDocumentSyncOptionsOrKind) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*TextDocumentSyncOptionsOrKind) UnmarshalJSON ¶
func (v *TextDocumentSyncOptionsOrKind) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type VersionedTextDocumentIdentifier ¶
type VersionedTextDocumentIdentifier struct { TextDocumentIdentifier /** * The version number of this document. */ Version int `json:"version"` }
type WorkspaceClientCapabilities ¶
type WorkspaceClientCapabilities struct{}