HandleRequest processes an LSP request and returns a result
(method string, params json.RawMessage)
| 139 | |
| 140 | // HandleRequest processes an LSP request and returns a result |
| 141 | func (h *Handler) HandleRequest(method string, params json.RawMessage) (interface{}, error) { |
| 142 | switch method { |
| 143 | case "initialize": |
| 144 | return h.handleInitialize(params) |
| 145 | case "shutdown": |
| 146 | return h.handleShutdown() |
| 147 | case "textDocument/hover": |
| 148 | return h.handleHover(params) |
| 149 | case "textDocument/completion": |
| 150 | return h.handleCompletion(params) |
| 151 | case "textDocument/formatting": |
| 152 | return h.handleFormatting(params) |
| 153 | case "textDocument/documentSymbol": |
| 154 | return h.handleDocumentSymbol(params) |
| 155 | case "textDocument/signatureHelp": |
| 156 | return h.handleSignatureHelp(params) |
| 157 | case "textDocument/codeAction": |
| 158 | return h.handleCodeAction(params) |
| 159 | case "textDocument/semanticTokens/full": |
| 160 | var semParams SemanticTokensParams |
| 161 | if err := json.Unmarshal(params, &semParams); err != nil { |
| 162 | return nil, err |
| 163 | } |
| 164 | return h.handleSemanticTokensFull(semParams) |
| 165 | default: |
| 166 | return nil, fmt.Errorf("method not found: %s", method) |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | // HandleNotification processes an LSP notification |
| 171 | func (h *Handler) HandleNotification(method string, params json.RawMessage) { |