Documentation ¶
Index ¶
- func NewHandler() 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 ContainedBinding
- type Diagnostic
- type DiagnosticRelatedInformation
- type DidChangeConfigurationParams
- type DidChangeTextDocumentParams
- type DidChangeWorkspaceFoldersParams
- type DidCloseTextDocumentParams
- type DidOpenTextDocumentParams
- type DidSaveTextDocumentParams
- type DocumentDefinitionParams
- type DocumentFormattingParams
- type DocumentSymbolParams
- type DocumentURI
- type ExecuteCommandParams
- type File
- type FormattingOptions
- type Hover
- type HoverParams
- type InitializeOptions
- type InitializeParams
- type InitializeResult
- type InsertTextFormat
- type LexicalAnalyzer
- func (analyzer *LexicalAnalyzer) Analyze(ctx context.Context, form bass.Annotate)
- func (analyzer *LexicalAnalyzer) Complete(ctx context.Context, prefix string, params TextDocumentPositionParams) []bass.Symbol
- func (analyzer *LexicalAnalyzer) Locate(ctx context.Context, binding bass.Symbol, params TextDocumentPositionParams) (bass.Range, bool)
- type LexicalBinding
- 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 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 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 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 any `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 DocumentSymbolParams ¶
type DocumentSymbolParams struct {
TextDocument TextDocumentIdentifier `json:"textDocument"`
}
DocumentSymbolParams is
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"` 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 LexicalAnalyzer ¶
type LexicalAnalyzer struct { Bindings []LexicalBinding Contained []ContainedBinding }
func (*LexicalAnalyzer) Analyze ¶
func (analyzer *LexicalAnalyzer) Analyze(ctx context.Context, form bass.Annotate)
func (*LexicalAnalyzer) Complete ¶
func (analyzer *LexicalAnalyzer) Complete(ctx context.Context, prefix string, params TextDocumentPositionParams) []bass.Symbol
type LexicalBinding ¶
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"` 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(uri 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 ¶
- analyzer.go
- diff.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