handleInitialize handles the initialize request
(params json.RawMessage)
| 187 | |
| 188 | // handleInitialize handles the initialize request |
| 189 | func (h *Handler) handleInitialize(params json.RawMessage) (*InitializeResult, error) { |
| 190 | var initParams InitializeParams |
| 191 | if err := json.Unmarshal(params, &initParams); err != nil { |
| 192 | return nil, err |
| 193 | } |
| 194 | |
| 195 | h.server.Logger().Printf("Initialize request from client, rootURI: %s", initParams.RootURI) |
| 196 | |
| 197 | return &InitializeResult{ |
| 198 | Capabilities: ServerCapabilities{ |
| 199 | TextDocumentSync: &TextDocumentSyncOptions{ |
| 200 | OpenClose: true, |
| 201 | Change: SyncIncremental, // Support incremental updates for better performance |
| 202 | Save: &SaveOptions{ |
| 203 | IncludeText: true, |
| 204 | }, |
| 205 | }, |
| 206 | CompletionProvider: &CompletionOptions{ |
| 207 | TriggerCharacters: []string{" ", ".", "("}, |
| 208 | ResolveProvider: false, |
| 209 | }, |
| 210 | HoverProvider: true, |
| 211 | DocumentFormattingProvider: true, |
| 212 | DocumentSymbolProvider: true, |
| 213 | SignatureHelpProvider: &SignatureHelpOptions{ |
| 214 | TriggerCharacters: []string{"(", ","}, |
| 215 | RetriggerCharacters: []string{","}, |
| 216 | }, |
| 217 | CodeActionProvider: &CodeActionOptions{ |
| 218 | CodeActionKinds: []CodeActionKind{CodeActionQuickFix}, |
| 219 | }, |
| 220 | SemanticTokensProvider: &SemanticTokensOptions{ |
| 221 | Legend: SemanticTokensLegend{ |
| 222 | TokenTypes: []string{ |
| 223 | "keyword", "identifier", "number", "string", "operator", "comment", |
| 224 | }, |
| 225 | TokenModifiers: []string{}, |
| 226 | }, |
| 227 | Full: true, |
| 228 | Range: false, |
| 229 | }, |
| 230 | }, |
| 231 | ServerInfo: &ServerInfo{ |
| 232 | Name: "gosqlx-lsp", |
| 233 | Version: "1.0.0", |
| 234 | }, |
| 235 | }, nil |
| 236 | } |
| 237 | |
| 238 | // handleInitialized is called when the client confirms initialization |
| 239 | func (h *Handler) handleInitialized() { |