From 023ed82e612451caa38ec46106ed9d148ab9a595 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 8 Feb 2026 10:39:51 +0200 Subject: add gitignore-aware file filtering for LSP completions and code actions 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 --- internal/lsp/server.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'internal/lsp/server.go') 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. -- cgit v1.2.3