feat(lsp): add code actions, signature help, and document highlights
Assisted-by: MiMo V2.5 Pro
This commit is contained in:
@@ -309,11 +309,75 @@ type ServerCapabilities struct {
|
||||
RenameProvider bool `json:"renameProvider,omitempty"`
|
||||
DocumentSymbolProvider bool `json:"documentSymbolProvider,omitempty"`
|
||||
DocumentFormattingProvider bool `json:"documentFormattingProvider,omitempty"`
|
||||
DocumentHighlightProvider bool `json:"documentHighlightProvider,omitempty"`
|
||||
CodeActionProvider bool `json:"codeActionProvider,omitempty"`
|
||||
SignatureHelpProvider map[string]any `json:"signatureHelpProvider,omitempty"`
|
||||
SemanticTokensProvider map[string]any `json:"semanticTokensProvider,omitempty"`
|
||||
InlayHintProvider bool `json:"inlayHintProvider,omitempty"`
|
||||
DiagnosticProvider map[string]any `json:"diagnosticProvider,omitempty"`
|
||||
}
|
||||
|
||||
// --- code actions -------------------------------------------------------------
|
||||
|
||||
type codeActionParams struct {
|
||||
TextDocument textDocumentIdentifier `json:"textDocument"`
|
||||
Range Range `json:"range"`
|
||||
Context codeActionContext `json:"context"`
|
||||
}
|
||||
|
||||
type codeActionContext struct {
|
||||
Diagnostics []Diagnostic `json:"diagnostics"`
|
||||
}
|
||||
|
||||
// CodeAction represents a quick fix or refactoring.
|
||||
type CodeAction struct {
|
||||
Title string `json:"title"`
|
||||
Kind string `json:"kind,omitempty"`
|
||||
Edit *WorkspaceEdit `json:"edit,omitempty"`
|
||||
}
|
||||
|
||||
// --- signature help -----------------------------------------------------------
|
||||
|
||||
type signatureHelpParams struct {
|
||||
TextDocument textDocumentIdentifier `json:"textDocument"`
|
||||
Position Position `json:"position"`
|
||||
}
|
||||
|
||||
// SignatureHelp represents signature information for a function call.
|
||||
type SignatureHelp struct {
|
||||
Signatures []SignatureInformation `json:"signatures"`
|
||||
}
|
||||
|
||||
// SignatureInformation represents a function signature.
|
||||
type SignatureInformation struct {
|
||||
Label string `json:"label"`
|
||||
Documentation string `json:"documentation,omitempty"`
|
||||
Parameters []ParameterInformation `json:"parameters,omitempty"`
|
||||
}
|
||||
|
||||
// ParameterInformation represents a parameter in a signature.
|
||||
type ParameterInformation struct {
|
||||
Label string `json:"label"`
|
||||
}
|
||||
|
||||
// --- document highlights ------------------------------------------------------
|
||||
|
||||
type documentHighlightParams struct {
|
||||
TextDocument textDocumentIdentifier `json:"textDocument"`
|
||||
Position Position `json:"position"`
|
||||
}
|
||||
|
||||
// DocumentHighlight represents a highlight range.
|
||||
type DocumentHighlight struct {
|
||||
Range Range `json:"range"`
|
||||
Kind int `json:"kind,omitempty"`
|
||||
}
|
||||
|
||||
const (
|
||||
highlightRead = 1
|
||||
highlightWrite = 2
|
||||
)
|
||||
|
||||
type initializeResult struct {
|
||||
Capabilities ServerCapabilities `json:"capabilities"`
|
||||
ServerInfo map[string]string `json:"serverInfo,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user