diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-08 10:39:51 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-08 10:39:51 +0200 |
| commit | d5b13224737a9f66c3d5113a885603b32867d740 (patch) | |
| tree | d482cc965a65be22604800fe6772279c52961b99 /internal/lsp/server.go | |
| parent | bd698b257a548d835fbc2675ff5be5e1a69ff229 (diff) | |
add gitignore-aware file filtering for LSP completions and code actionsv0.18.0
Files matching .gitignore patterns or user-configured extra patterns are
now skipped for completions and code actions. Configurable via [ignore]
section in config.toml with gitignore, extra_patterns, and
lsp_notify_ignored options. Includes hot-reload support and env var
overrides (HEXAI_IGNORE_*).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/lsp/server.go')
| -rw-r--r-- | internal/lsp/server.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/lsp/server.go b/internal/lsp/server.go index c226ab4..a5a8a2a 100644 --- a/internal/lsp/server.go +++ b/internal/lsp/server.go @@ -12,6 +12,7 @@ import ( "time" "codeberg.org/snonux/hexai/internal/appconfig" + "codeberg.org/snonux/hexai/internal/ignore" "codeberg.org/snonux/hexai/internal/llm" "codeberg.org/snonux/hexai/internal/logging" "codeberg.org/snonux/hexai/internal/runtimeconfig" @@ -50,6 +51,9 @@ type Server struct { completionsDisabled bool + // Gitignore-aware file checker (nil when disabled) + ignoreChecker *ignore.Checker + // Dispatch table for JSON-RPC methods → handler functions handlers map[string]func(Request) } @@ -101,6 +105,9 @@ type ServerOptions struct { // Custom actions CustomActions []CustomAction + + // Gitignore-aware file checker (optional) + IgnoreChecker *ignore.Checker } // CustomAction mirrors user-defined code actions passed from config. @@ -204,6 +211,9 @@ func (s *Server) applyOptions(opts ServerOptions) { s.llmProvider = canonicalProvider(s.cfg.Provider) } s.altClients = make(map[string]llm.Client) + if opts.IgnoreChecker != nil { + s.ignoreChecker = opts.IgnoreChecker + } } // ApplyOptions updates the server's configuration at runtime. |
