Documentation
¶
Index ¶
- Constants
- type ClientInfo
- type CodeAction
- type CodeActionParams
- type Command
- type CompletionItem
- type CompletionParams
- type Diagnostic
- type DiagnosticSeverity
- type DidChangeTextDocumentParams
- type DidOpenTextDocumentParams
- type Error
- type IncomingMsg
- type InitializeParams
- type InitializeResult
- type Location
- type Msg
- type Notification
- type Pos
- type PublishDiagnosticsParams
- type Range
- type Request
- type Response
- type ServerCapabilities
- type ServerInfo
- type TextDocumentContentChangeEvent
- type TextDocumentIdentifier
- type TextDocumentItem
- type TextDocumentPositionParams
- type TextEdit
- type VersionedTextDocumentIdentifier
- type WorkspaceEdit
Constants ¶
View Source
const ( INITIALIZE = "initialize" TD_DID_OPEN = "textDocument/didOpen" TD_DID_CHANGE = "textDocument/didChange" TD_COMPLETION = "textDocument/completion" TD_CODE_ACTION = "textDocument/codeAction" TD_PUBLISH_DIAGNOSTICS = "textDocument/publishDiagnostics" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientInfo ¶
type CodeAction ¶
type CodeAction struct {
Title string `json:"title"`
Edit *WorkspaceEdit `json:"edit,omitempty"`
Command *Command `json:"command,omitempty"`
}
func NewCodeActionEdit ¶
func NewCodeActionEdit(title string, edit WorkspaceEdit) CodeAction
type CodeActionParams ¶
type CodeActionParams struct {
// The document in which the command was invoked.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// The range for which the command was invoked.
Range Range `json:"range"`
}
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, UNLESS TEXTEDIT PROVIDED.
*
* If label details are provided the label itself should
* be an unqualified name of the completion item.
*/
Label string `json:"label"`
Detail string `json:"detail"`
Doc string `json:"documentation,omitempty"`
TextEdit *TextEdit `json:"textEdit,omitempty"`
}
func NewCompletionItem ¶
func NewCompletionItem(label, detail, doc string) CompletionItem
type CompletionParams ¶
type CompletionParams struct {
TextDocumentPositionParams
}
type Diagnostic ¶
type Diagnostic struct {
Range Range `json:"range"`
Severity DiagnosticSeverity `json:"severity"`
/**
* A human-readable string describing the source of this
* diagnostic, e.g. 'typescript' or 'super lint'.
*/
Source string `json:"source"`
/** The diagnostic's message. */
Message string `json:"message"`
}
func NewDiagnostic ¶
func NewDiagnostic(rang Range, severity DiagnosticSeverity, source, msg string) Diagnostic
func NewDiagnosticFromCheck ¶
func NewDiagnosticFromCheck(checkD check.Diagnostic) Diagnostic
type DiagnosticSeverity ¶
type DiagnosticSeverity int
const ( Err DiagnosticSeverity = 1 Warn DiagnosticSeverity = 2 Info DiagnosticSeverity = 3 Hint DiagnosticSeverity = 4 )
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"`
}
type DidOpenTextDocumentParams ¶
type DidOpenTextDocumentParams struct {
/**
* The document that was opened.
*/
TextDocument TextDocumentItem `json:"textDocument"`
}
type Error ¶
type IncomingMsg ¶
type IncomingMsg struct {
Msg
Id *json.RawMessage `json:"id"`
Method string `json:"method"`
Params *json.RawMessage `json:"params"`
}
func (IncomingMsg) AsNotification ¶
func (m IncomingMsg) AsNotification() (Notification, bool)
func (IncomingMsg) AsRequest ¶
func (m IncomingMsg) AsRequest() (Request, bool)
func (IncomingMsg) IsNotification ¶
func (m IncomingMsg) IsNotification() bool
func (IncomingMsg) IsRequest ¶
func (m IncomingMsg) IsRequest() bool
type InitializeParams ¶
type InitializeParams struct {
ClientInfo *ClientInfo `json:"clientInfo"`
}
type InitializeResult ¶
type InitializeResult struct {
Capabilities ServerCapabilities `json:"capabilities"`
ServerInfo ServerInfo `json:"serverInfo"`
}
func NewInitializeResult ¶
func NewInitializeResult() InitializeResult
type Msg ¶
type Msg struct {
Rpc string `json:"jsonrpc"` // probably always be 2.0
}
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#message
type Notification ¶
type Notification struct {
Msg
Method string `json:"method"`
Params *json.RawMessage `json:"params"`
}
func NewNotification ¶
func NewNotification(method string, params *json.RawMessage) Notification
type Pos ¶
type PublishDiagnosticsParams ¶
type PublishDiagnosticsParams struct {
Uri string `json:"uri"`
Diagnostics []Diagnostic `json:"diagnostics"`
}
func NewPublishDiagnosticsParams ¶
func NewPublishDiagnosticsParams(uri string, diagnostics []Diagnostic) PublishDiagnosticsParams
type Request ¶
type Request struct {
Msg
Id *json.RawMessage `json:"id"`
Method string `json:"method"`
Params *json.RawMessage `json:"params"`
}
type Response ¶
type Response struct {
Msg
Id *json.RawMessage `json:"id"`
Result any `json:"result"`
Error *Error `json:"error,omitempty"`
}
func NewResponse ¶
func NewResponse(id *json.RawMessage, result any) Response
func NewResponseError ¶
func NewResponseError(id *json.RawMessage, err error) (resp Response)
type ServerCapabilities ¶
type ServerInfo ¶
type TextDocumentContentChangeEvent ¶
type TextDocumentContentChangeEvent struct {
/**
* The new text of the whole document.
*/
Text string `json:"text"`
}
*
- An event describing a change to a text document. If only a text is provided
- it is considered to be the full content of the document.
type TextDocumentIdentifier ¶
type TextDocumentIdentifier struct {
Uri string `json:"uri"`
}
type TextDocumentItem ¶
type TextDocumentItem struct {
/**
* The text document's URI.
*/
Uri string `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"`
}
type TextDocumentPositionParams ¶
type TextDocumentPositionParams struct {
TextDocument TextDocumentIdentifier `json:"textDocument"`
Position Pos `json:"position"`
}
type TextEdit ¶
func NewTextEdit ¶
type VersionedTextDocumentIdentifier ¶
type VersionedTextDocumentIdentifier struct {
TextDocumentIdentifier
Version int `json:"version"`
}
type WorkspaceEdit ¶
func NewWorkspaceEdit ¶
func NewWorkspaceEdit() WorkspaceEdit
Click to show internal directories.
Click to hide internal directories.