summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/hexai/main.go10
-rw-r--r--docs/configuration.md1
-rw-r--r--internal/hexailsp/run.go8
3 files changed, 12 insertions, 7 deletions
diff --git a/cmd/hexai/main.go b/cmd/hexai/main.go
index a6fc1a6..33b0365 100644
--- a/cmd/hexai/main.go
+++ b/cmd/hexai/main.go
@@ -52,13 +52,17 @@ func main() {
selection = append(selection, i)
}
}
+ finalPath := strings.TrimSpace(*configFlag)
+ if finalPath == "" {
+ finalPath = configPath
+ }
ctx := context.Background()
+ if finalPath != "" {
+ ctx = hexaicli.WithCLIConfigPath(ctx, finalPath)
+ }
if len(selection) > 0 {
ctx = hexaicli.WithCLISelection(ctx, selection)
}
- if path := strings.TrimSpace(*configFlag); path != "" {
- ctx = hexaicli.WithCLIConfigPath(ctx, path)
- }
if err := hexaicli.Run(ctx, fs.Args(), os.Stdin, os.Stdout, os.Stderr); err != nil {
os.Exit(1)
}
diff --git a/docs/configuration.md b/docs/configuration.md
index 6e42172..b586879 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -27,6 +27,7 @@ Environment overrides
Per-surface models
- Use the `[models]` table in `config.toml` to tailor individual entry points (completion, code actions, chat, CLI) without changing the global provider default.
+- All entry points accept `--config /path/to/config.toml` to point at an alternate file. Helix `/reload>` reuses the same path when active.
- Each key accepts either a string (shortcut) or one or more tables with `model` / `temperature` fields, e.g.:
```toml
diff --git a/internal/hexailsp/run.go b/internal/hexailsp/run.go
index 750e544..0e383ac 100644
--- a/internal/hexailsp/run.go
+++ b/internal/hexailsp/run.go
@@ -65,7 +65,7 @@ func RunWithFactory(logPath string, configPath string, stdin io.Reader, stdout i
store := runtimeconfig.New(cfg)
logContext := strings.TrimSpace(logPath) != ""
loadOpts := appconfig.LoadOptions{ConfigPath: strings.TrimSpace(configPath)}
- opts := makeServerOptions(cfg, logContext, client)
+ opts := makeServerOptions(cfg, logContext, client, loadOpts)
opts.ConfigLoadOptions = loadOpts
opts.ConfigStore = store
server := factory(stdin, stdout, logger, opts)
@@ -79,8 +79,7 @@ func RunWithFactory(logPath string, configPath string, stdin io.Reader, stdout i
if newClient := buildClientIfNil(updated, nil); newClient != nil {
client = newClient
}
- opts := makeServerOptions(updated, logContext, client)
- opts.ConfigLoadOptions = loadOpts
+ opts := makeServerOptions(updated, logContext, client, loadOpts)
opts.ConfigStore = store
configurable.ApplyOptions(opts)
})
@@ -144,7 +143,7 @@ func ensureFactory(factory ServerFactory) ServerFactory {
}
}
-func makeServerOptions(cfg appconfig.App, logContext bool, client llm.Client) lsp.ServerOptions {
+func makeServerOptions(cfg appconfig.App, logContext bool, client llm.Client, loadOpts appconfig.LoadOptions) lsp.ServerOptions {
// Map custom actions from appconfig to lsp type
var customs []lsp.CustomAction
if len(cfg.CustomActions) > 0 {
@@ -162,6 +161,7 @@ func makeServerOptions(cfg appconfig.App, logContext bool, client llm.Client) ls
}
}
return lsp.ServerOptions{
+ ConfigLoadOptions: loadOpts,
LogContext: logContext,
ConfigStore: nil,
Config: &cfg,