diff options
| author | Paul Buetow <paul@buetow.org> | 2025-08-29 00:22:39 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-08-29 00:22:39 +0300 |
| commit | 0c2994f0065090a4884b28dc27eb760db2dfaab3 (patch) | |
| tree | 687ecd00584feb634a5853f5964028621f0fa1d5 /internal/lsp/handlers_init.go | |
| parent | d35aaa0227334ab0269b0907491c0682841b9cd5 (diff) | |
lsp: refactor dispatch to handler map; split handlers into feature files (completion, codeaction, init, document); decompose completion logic into small helpers; update review checklist
Diffstat (limited to 'internal/lsp/handlers_init.go')
| -rw-r--r-- | internal/lsp/handlers_init.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/internal/lsp/handlers_init.go b/internal/lsp/handlers_init.go new file mode 100644 index 0000000..1047e78 --- /dev/null +++ b/internal/lsp/handlers_init.go @@ -0,0 +1,40 @@ +// Summary: Initialization and lifecycle handlers split from handlers.go. +package lsp + +import ( + "hexai/internal" + "hexai/internal/logging" + "os" +) + +func (s *Server) handleInitialize(req Request) { + version := internal.Version + if s.llmClient != nil { + version = version + " [" + s.llmClient.Name() + ":" + s.llmClient.DefaultModel() + "]" + } + res := InitializeResult{ + Capabilities: ServerCapabilities{ + TextDocumentSync: 1, // 1 = TextDocumentSyncKindFull + CompletionProvider: &CompletionOptions{ + ResolveProvider: false, + TriggerCharacters: s.triggerChars, + }, + CodeActionProvider: CodeActionOptions{ResolveProvider: true}, + }, + ServerInfo: &ServerInfo{Name: "hexai", Version: version}, + } + s.reply(req.ID, res, nil) +} + +func (s *Server) handleInitialized() { + logging.Logf("lsp ", "client initialized") +} + +func (s *Server) handleShutdown(req Request) { + s.reply(req.ID, nil, nil) +} + +func (s *Server) handleExit() { + s.exited = true + os.Exit(0) +} |
