Documentation
¶
Index ¶
- func LogMessageStandalone(typ MessageType, message string)
- func NewHandler(config *Config) jsonrpc2.Handler
- type ClientCapabilities
- type CodeAction
- type CodeActionContext
- type CodeActionKind
- type CodeActionParams
- type Command
- type CompletionContext
- type CompletionItem
- type CompletionItemKind
- type CompletionItemTag
- type CompletionParams
- type CompletionProvider
- type Config
- type Config1
- type Diagnostic
- type DiagnosticRelatedInformation
- type DidChangeConfigurationParams
- type DidChangeTextDocumentParams
- type DidChangeWorkspaceFoldersParams
- type DidCloseTextDocumentParams
- type DidOpenTextDocumentParams
- type DidSaveTextDocumentParams
- type DocumentDefinitionParams
- type DocumentFormattingParams
- type DocumentRangeFormattingParams
- type DocumentSymbolParams
- type DocumentURI
- type Duration
- type ExecuteCommandParams
- type File
- type FormattingOptions
- type Hover
- type HoverParams
- type InitializeOptions
- type InitializeParams
- type InitializeResult
- type InsertTextFormat
- type Language
- type Location
- type LogMessageParams
- type MarkedString
- type MarkupContent
- type MarkupKind
- type MessageType
- type NotificationMessage
- type OpKind
- type PartialResultParams
- type Position
- type PublishDiagnosticsParams
- type Range
- type ServerCapabilities
- type ServerCapabilitiesWorkspace
- type ShowMessageParams
- type Stdrwc
- type SymbolInformation
- type TextDocumentContentChangeEvent
- type TextDocumentIdentifier
- type TextDocumentItem
- type TextDocumentPositionParams
- type TextDocumentSyncKind
- type TextEdit
- type VersionedTextDocumentIdentifier
- type WorkDoneProgressParams
- type WorkspaceEdit
- type WorkspaceFolder
- type WorkspaceFoldersChangeEvent
- type WorkspaceFoldersServerCapabilities
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogMessageStandalone ¶
func LogMessageStandalone(typ MessageType, message string)
func NewHandler ¶
NewHandler create JSON-RPC handler for this language server.
Types ¶
type CodeAction ¶
type CodeAction struct { Title string `json:"title"` Diagnostics []Diagnostic `json:"diagnostics"` IsPreferred bool `json:"isPreferred"` // TODO Edit *WorkspaceEdit `json:"edit"` Command *Command `json:"command"` }
CodeAction is
type CodeActionContext ¶
type CodeActionContext struct { Diagnostics []Diagnostic `json:"diagnostics"` Only []CodeActionKind `json:"only,omitempty"` }
CodeActionContext is
type CodeActionKind ¶
type CodeActionKind string
CodeActionKind is
const ( Empty CodeActionKind = "" QuickFix CodeActionKind = "quickfix" Refactor CodeActionKind = "refactor" RefactorExtract CodeActionKind = "refactor.extract" RefactorInline CodeActionKind = "refactor.inline" RefactorRewrite CodeActionKind = "refactor.rewrite" Source CodeActionKind = "source" SourceOrganizeImports CodeActionKind = "source.organizeImports" )
Empty is
type CodeActionParams ¶
type CodeActionParams struct { WorkDoneProgressParams PartialResultParams TextDocument TextDocumentIdentifier `json:"textDocument"` Range Range `json:"range"` Context CodeActionContext `json:"context"` }
CodeActionParams is
type Command ¶
type Command struct { Title string `json:"title" yaml:"title"` Command string `json:"command" yaml:"command"` Arguments []any `json:"arguments,omitempty" yaml:"arguments,omitempty"` OS string `json:"-" yaml:"os,omitempty"` }
Command is
type CompletionContext ¶
type CompletionContext struct { TriggerKind int `json:"triggerKind"` TriggerCharacter *string `json:"triggerCharacter"` }
CompletionContext is
type CompletionItem ¶
type CompletionItem struct { Label string `json:"label"` Kind CompletionItemKind `json:"kind,omitempty"` Tags []CompletionItemTag `json:"tags,omitempty"` Detail string `json:"detail,omitempty"` Documentation string `json:"documentation,omitempty"` // string | MarkupContent Deprecated bool `json:"deprecated,omitempty"` Preselect bool `json:"preselect,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"` AdditionalTextEdits []TextEdit `json:"additionalTextEdits,omitempty"` CommitCharacters []string `json:"commitCharacters,omitempty"` Command *Command `json:"command,omitempty"` Data any `json:"data,omitempty"` }
CompletionItem is
type CompletionItemKind ¶
type CompletionItemKind int
CompletionItemKind is
const ( TextCompletion CompletionItemKind = 1 MethodCompletion CompletionItemKind = 2 FunctionCompletion CompletionItemKind = 3 ConstructorCompletion CompletionItemKind = 4 FieldCompletion CompletionItemKind = 5 VariableCompletion CompletionItemKind = 6 ClassCompletion CompletionItemKind = 7 InterfaceCompletion CompletionItemKind = 8 ModuleCompletion CompletionItemKind = 9 PropertyCompletion CompletionItemKind = 10 UnitCompletion CompletionItemKind = 11 ValueCompletion CompletionItemKind = 12 EnumCompletion CompletionItemKind = 13 KeywordCompletion CompletionItemKind = 14 SnippetCompletion CompletionItemKind = 15 ColorCompletion CompletionItemKind = 16 FileCompletion CompletionItemKind = 17 ReferenceCompletion CompletionItemKind = 18 FolderCompletion CompletionItemKind = 19 EnumMemberCompletion CompletionItemKind = 20 ConstantCompletion CompletionItemKind = 21 StructCompletion CompletionItemKind = 22 EventCompletion CompletionItemKind = 23 OperatorCompletion CompletionItemKind = 24 TypeParameterCompletion CompletionItemKind = 25 )
TextCompletion is
type CompletionParams ¶
type CompletionParams struct { TextDocumentPositionParams CompletionContext CompletionContext `json:"contentChanges"` }
CompletionParams is
type CompletionProvider ¶
type CompletionProvider struct { ResolveProvider bool `json:"resolveProvider,omitempty"` TriggerCharacters []string `json:"triggerCharacters"` }
CompletionProvider is
type Config ¶
type Config struct { Version int `yaml:"version"` LogFile string `yaml:"log-file"` LogLevel int `yaml:"log-level" json:"logLevel"` Commands *[]Command `yaml:"commands" json:"commands"` Languages *map[string][]Language `yaml:"languages" json:"languages"` RootMarkers *[]string `yaml:"root-markers" json:"rootMarkers"` TriggerChars []string `yaml:"trigger-chars" json:"triggerChars"` LintDebounce Duration `yaml:"lint-debounce" json:"lintDebounce"` FormatDebounce Duration `yaml:"format-debounce" json:"formatDebounce"` // Toggle support for "go to definition" requests. ProvideDefinition bool `yaml:"provide-definition"` Filename string `yaml:"-"` Logger *log.Logger `yaml:"-"` }
Config is
func LoadConfig ¶
LoadConfig load configuration from file
type Config1 ¶
type Config1 struct { Version int `yaml:"version"` Logger *log.Logger `yaml:"-"` Commands []Command `yaml:"commands"` Languages map[string]Language `yaml:"languages"` }
Config1 is
type Diagnostic ¶
type Diagnostic struct { Range Range `json:"range"` Severity int `json:"severity,omitempty"` Code *string `json:"code,omitempty"` Source *string `json:"source,omitempty"` Message string `json:"message"` RelatedInformation []DiagnosticRelatedInformation `json:"relatedInformation,omitempty"` }
Diagnostic is
type DiagnosticRelatedInformation ¶
type DiagnosticRelatedInformation struct { Location Location `json:"location"` Message string `json:"message"` }
DiagnosticRelatedInformation is
type DidChangeConfigurationParams ¶
type DidChangeConfigurationParams struct {
Settings Config `json:"settings"`
}
DidChangeConfigurationParams is
type DidChangeTextDocumentParams ¶
type DidChangeTextDocumentParams struct { TextDocument VersionedTextDocumentIdentifier `json:"textDocument"` ContentChanges []TextDocumentContentChangeEvent `json:"contentChanges"` }
DidChangeTextDocumentParams is
type DidChangeWorkspaceFoldersParams ¶
type DidChangeWorkspaceFoldersParams struct {
Event WorkspaceFoldersChangeEvent `json:"event"`
}
DidChangeWorkspaceFoldersParams is
type DidCloseTextDocumentParams ¶
type DidCloseTextDocumentParams struct {
TextDocument TextDocumentIdentifier `json:"textDocument"`
}
DidCloseTextDocumentParams is
type DidOpenTextDocumentParams ¶
type DidOpenTextDocumentParams struct {
TextDocument TextDocumentItem `json:"textDocument"`
}
DidOpenTextDocumentParams is
type DidSaveTextDocumentParams ¶
type DidSaveTextDocumentParams struct { Text *string `json:"text"` TextDocument TextDocumentIdentifier `json:"textDocument"` }
DidSaveTextDocumentParams is
type DocumentDefinitionParams ¶
type DocumentDefinitionParams struct { TextDocumentPositionParams WorkDoneProgressParams PartialResultParams }
DocumentDefinitionParams is
type DocumentFormattingParams ¶
type DocumentFormattingParams struct { TextDocument TextDocumentIdentifier `json:"textDocument"` Options FormattingOptions `json:"options"` }
DocumentFormattingParams is
type DocumentRangeFormattingParams ¶
type DocumentRangeFormattingParams struct { TextDocument TextDocumentIdentifier `json:"textDocument"` Range Range `json:"range"` Options FormattingOptions `json:"options"` }
DocumentRangeFormattingParams is
type DocumentSymbolParams ¶
type DocumentSymbolParams struct {
TextDocument TextDocumentIdentifier `json:"textDocument"`
}
DocumentSymbolParams is
type Duration ¶
Duration time.Duration wrapper
func (Duration) MarshalJSON ¶
MarshalJSON method mash to json
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON method Unmash duration from string or decimal
type ExecuteCommandParams ¶
type ExecuteCommandParams struct { WorkDoneProgressParams Command string `json:"command"` Arguments []any `json:"arguments,omitempty"` }
ExecuteCommandParams is
type InitializeOptions ¶
type InitializeOptions struct { DocumentFormatting bool `json:"documentFormatting"` RangeFormatting bool `json:"documentRangeFormatting"` Hover bool `json:"hover"` DocumentSymbol bool `json:"documentSymbol"` CodeAction bool `json:"codeAction"` Completion bool `json:"completion"` }
InitializeOptions is
type InitializeParams ¶
type InitializeParams struct { ProcessID int `json:"processId,omitempty"` RootURI DocumentURI `json:"rootUri,omitempty"` InitializationOptions *InitializeOptions `json:"initializationOptions,omitempty"` Capabilities ClientCapabilities `json:"capabilities,omitempty"` Trace string `json:"trace,omitempty"` }
InitializeParams is
type InitializeResult ¶
type InitializeResult struct {
Capabilities ServerCapabilities `json:"capabilities,omitempty"`
}
InitializeResult is
type InsertTextFormat ¶
type InsertTextFormat int
InsertTextFormat is
const ( PlainTextTextFormat InsertTextFormat = 1 SnippetTextFormat InsertTextFormat = 2 )
PlainTextTextFormat is
type Language ¶
type Language struct { Prefix string `yaml:"prefix" json:"prefix"` LintFormats []string `yaml:"lint-formats" json:"lintFormats"` LintStdin bool `yaml:"lint-stdin" json:"lintStdin"` LintOffset int `yaml:"lint-offset" json:"lintOffset"` LintOffsetColumns int `yaml:"lint-offset-columns" json:"lintOffsetColumns"` LintCommand string `yaml:"lint-command" json:"lintCommand"` LintIgnoreExitCode bool `yaml:"lint-ignore-exit-code" json:"lintIgnoreExitCode"` LintCategoryMap map[string]string `yaml:"lint-category-map" json:"lintCategoryMap"` LintSource string `yaml:"lint-source" json:"lintSource"` LintSeverity int `yaml:"lint-severity" json:"lintSeverity"` LintWorkspace bool `yaml:"lint-workspace" json:"lintWorkspace"` LintAfterOpen bool `yaml:"lint-after-open" json:"lintAfterOpen"` LintOnSave bool `yaml:"lint-on-save" json:"lintOnSave"` FormatCommand string `yaml:"format-command" json:"formatCommand"` FormatCanRange bool `yaml:"format-can-range" json:"formatCanRange"` FormatStdin bool `yaml:"format-stdin" json:"formatStdin"` SymbolCommand string `yaml:"symbol-command" json:"symbolCommand"` SymbolStdin bool `yaml:"symbol-stdin" json:"symbolStdin"` SymbolFormats []string `yaml:"symbol-formats" json:"symbolFormats"` CompletionCommand string `yaml:"completion-command" json:"completionCommand"` CompletionStdin bool `yaml:"completion-stdin" json:"completionStdin"` HoverCommand string `yaml:"hover-command" json:"hoverCommand"` HoverStdin bool `yaml:"hover-stdin" json:"hoverStdin"` HoverType string `yaml:"hover-type" json:"hoverType"` HoverChars string `yaml:"hover-chars" json:"hoverChars"` Env []string `yaml:"env" json:"env"` RootMarkers []string `yaml:"root-markers" json:"rootMarkers"` RequireMarker bool `yaml:"require-marker" json:"requireMarker"` Commands []Command `yaml:"commands" json:"commands"` }
Language is
type Location ¶
type Location struct { URI DocumentURI `json:"uri"` Range Range `json:"range"` }
Location is
type LogMessageParams ¶
type LogMessageParams struct { Type MessageType `json:"type"` Message string `json:"message"` }
LogMessageParams is
type MarkedString ¶
MarkedString is
type MarkupContent ¶
type MarkupContent struct { Kind MarkupKind `json:"kind"` Value string `json:"value"` }
MarkupContent is
type MarkupKind ¶
type MarkupKind string
MarkupKind is
const ( PlainText MarkupKind = "plaintext" Markdown MarkupKind = "markdown" )
PlainText is
type MessageType ¶
type MessageType int
MessageType is
const ( LogError MessageType LogWarning LogInfo LogLog )
LogError is
type NotificationMessage ¶
NotificationMessage is
type OpKind ¶
type OpKind int
OpKind is used to denote the type of operation a line represents.
const ( // Delete is the operation kind for a line that is present in the input // but not in the output. Delete OpKind = iota // Insert is the operation kind for a line that is new in the output. Insert // Equal is the operation kind for a line that is the same in the input and // output, often used to provide context around edited lines. Equal )
type PartialResultParams ¶
type PartialResultParams struct {
PartialResultToken any `json:"partialResultToken"`
}
PartialResultParams is
type PublishDiagnosticsParams ¶
type PublishDiagnosticsParams struct { URI DocumentURI `json:"uri"` Diagnostics []Diagnostic `json:"diagnostics"` Version int `json:"version"` }
PublishDiagnosticsParams is
type ServerCapabilities ¶
type ServerCapabilities struct { TextDocumentSync TextDocumentSyncKind `json:"textDocumentSync,omitempty"` DocumentSymbolProvider bool `json:"documentSymbolProvider,omitempty"` CompletionProvider *CompletionProvider `json:"completionProvider,omitempty"` DefinitionProvider bool `json:"definitionProvider,omitempty"` DocumentFormattingProvider bool `json:"documentFormattingProvider,omitempty"` RangeFormattingProvider bool `json:"documentRangeFormattingProvider,omitempty"` HoverProvider bool `json:"hoverProvider,omitempty"` CodeActionProvider bool `json:"codeActionProvider,omitempty"` Workspace *ServerCapabilitiesWorkspace `json:"workspace,omitempty"` }
ServerCapabilities is
type ServerCapabilitiesWorkspace ¶
type ServerCapabilitiesWorkspace struct {
WorkspaceFolders WorkspaceFoldersServerCapabilities `json:"workspaceFolders"`
}
ServerCapabilitiesWorkspace is
type ShowMessageParams ¶
type ShowMessageParams struct { Type MessageType `json:"type"` Message string `json:"message"` }
ShowMessageParams is
type SymbolInformation ¶
type SymbolInformation struct { Name string `json:"name"` Kind int64 `json:"kind"` Deprecated bool `json:"deprecated"` Location Location `json:"location"` ContainerName *string `json:"containerName"` }
SymbolInformation is
type TextDocumentContentChangeEvent ¶
type TextDocumentContentChangeEvent struct { Range Range `json:"range"` RangeLength int `json:"rangeLength"` Text string `json:"text"` }
TextDocumentContentChangeEvent is
type TextDocumentIdentifier ¶
type TextDocumentIdentifier struct {
URI DocumentURI `json:"uri"`
}
TextDocumentIdentifier is
type TextDocumentItem ¶
type TextDocumentItem struct { URI DocumentURI `json:"uri"` LanguageID string `json:"languageId"` Version int `json:"version"` Text string `json:"text"` }
TextDocumentItem is
type TextDocumentPositionParams ¶
type TextDocumentPositionParams struct { TextDocument TextDocumentIdentifier `json:"textDocument"` Position Position `json:"position"` }
TextDocumentPositionParams is
type TextDocumentSyncKind ¶
type TextDocumentSyncKind int
TextDocumentSyncKind is
const ( TDSKNone TextDocumentSyncKind = iota TDSKFull TDSKIncremental )
TDSKNone is
type TextEdit ¶
TextEdit is
func ComputeEdits ¶
func ComputeEdits(_ DocumentURI, before, after string) []TextEdit
ComputeEdits computes diff edits from 2 string inputs
type VersionedTextDocumentIdentifier ¶
type VersionedTextDocumentIdentifier struct { TextDocumentIdentifier Version int `json:"version"` }
VersionedTextDocumentIdentifier is
type WorkDoneProgressParams ¶
type WorkDoneProgressParams struct {
WorkDoneToken any `json:"workDoneToken"`
}
WorkDoneProgressParams is
type WorkspaceEdit ¶
type WorkspaceEdit struct { Changes any `json:"changes"` // { [uri: DocumentUri]: TextEdit[]; }; DocumentChanges any `json:"documentChanges"` // (TextDocumentEdit[] | (TextDocumentEdit | CreateFile | RenameFile | DeleteFile)[]); }
WorkspaceEdit is
type WorkspaceFolder ¶
type WorkspaceFolder struct { URI DocumentURI `json:"uri"` Name string `json:"name"` }
WorkspaceFolder is
type WorkspaceFoldersChangeEvent ¶
type WorkspaceFoldersChangeEvent struct { Added []WorkspaceFolder `json:"added,omitempty"` Removed []WorkspaceFolder `json:"removed,omitempty"` }
WorkspaceFoldersChangeEvent is
type WorkspaceFoldersServerCapabilities ¶
type WorkspaceFoldersServerCapabilities struct { Supported bool `json:"supported"` ChangeNotifications bool `json:"changeNotifications"` }
WorkspaceFoldersServerCapabilities is
Source Files
¶
- config.go
- diff.go
- duration.go
- handle_initialize.go
- handle_shutdown.go
- handle_text_document_code_action.go
- handle_text_document_completion.go
- handle_text_document_definition.go
- handle_text_document_did_change.go
- handle_text_document_did_close.go
- handle_text_document_did_open.go
- handle_text_document_did_save.go
- handle_text_document_formatting.go
- handle_text_document_hover.go
- handle_text_document_symbol.go
- handle_workspace_did_change_configuration.go
- handle_workspace_did_change_workspace_folders.go
- handle_workspace_execute_command.go
- handle_workspace_workspace_folders.go
- handler.go
- lsp.go
- notify.go
- stdrwc.go
- util.go