summaryrefslogtreecommitdiff
path: root/internal/lsp
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-09-28 17:30:44 +0300
committerPaul Buetow <paul@buetow.org>2025-09-28 17:30:44 +0300
commit0761409497041c752086b9aded08cf9e32e30fd2 (patch)
treee62721bc119d4ae435d2609292faea06a68244a4 /internal/lsp
parent0ac2d186e84f77d73d924e2c0ce975a17c3a8078 (diff)
Add --config flag support across CLI, LSP, and tmux tools
Diffstat (limited to 'internal/lsp')
-rw-r--r--internal/lsp/chat_commands.go5
-rw-r--r--internal/lsp/server.go17
2 files changed, 13 insertions, 9 deletions
diff --git a/internal/lsp/chat_commands.go b/internal/lsp/chat_commands.go
index 89efa49..b2da7d4 100644
--- a/internal/lsp/chat_commands.go
+++ b/internal/lsp/chat_commands.go
@@ -4,7 +4,6 @@ import (
"fmt"
"strings"
- "codeberg.org/snonux/hexai/internal/appconfig"
"codeberg.org/snonux/hexai/internal/runtimeconfig"
)
@@ -40,7 +39,9 @@ func (s *Server) handleReloadCommand() chatCommandResult {
if s.configStore == nil {
return chatCommandResult{message: "Reload unavailable: no config store"}
}
- changes, err := s.configStore.Reload(s.logger, appconfig.LoadOptions{IgnoreEnv: true})
+ loadOpts := s.configLoadOpts
+ loadOpts.IgnoreEnv = true
+ changes, err := s.configStore.Reload(s.logger, loadOpts)
if err != nil {
s.logger.Printf("config reload failed: %v", err)
return chatCommandResult{message: fmt.Sprintf("Reload failed: %v", err)}
diff --git a/internal/lsp/server.go b/internal/lsp/server.go
index f8b328b..974b926 100644
--- a/internal/lsp/server.go
+++ b/internal/lsp/server.go
@@ -43,6 +43,7 @@ type Server struct {
compCache map[string]string
compCacheOrder []string // most-recent at end; cap ~10
pendingCompletions map[string][]CompletionItem
+ configLoadOpts appconfig.LoadOptions
// Outgoing JSON-RPC id counter for server-initiated requests
nextID int64
lastLLMCall time.Time
@@ -53,13 +54,14 @@ type Server struct {
// ServerOptions collects configuration for NewServer to avoid long parameter lists.
type ServerOptions struct {
- LogContext bool
- ConfigStore *runtimeconfig.Store
- Config *appconfig.App
- MaxTokens int
- ContextMode string
- WindowLines int
- MaxContextTokens int
+ LogContext bool
+ ConfigStore *runtimeconfig.Store
+ Config *appconfig.App
+ MaxTokens int
+ ContextMode string
+ WindowLines int
+ MaxContextTokens int
+ ConfigLoadOptions appconfig.LoadOptions
Client llm.Client
TriggerCharacters []string
@@ -136,6 +138,7 @@ func (s *Server) applyOptions(opts ServerOptions) {
s.mu.Lock()
defer s.mu.Unlock()
s.logContext = opts.LogContext
+ s.configLoadOpts = opts.ConfigLoadOptions
if opts.ConfigStore != nil {
s.configStore = opts.ConfigStore
}