summaryrefslogtreecommitdiff
path: root/internal/lsp/handlers_completion.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-08 10:39:51 +0200
committerPaul Buetow <paul@buetow.org>2026-02-08 10:39:51 +0200
commitd5b13224737a9f66c3d5113a885603b32867d740 (patch)
treed482cc965a65be22604800fe6772279c52961b99 /internal/lsp/handlers_completion.go
parentbd698b257a548d835fbc2675ff5be5e1a69ff229 (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/handlers_completion.go')
-rw-r--r--internal/lsp/handlers_completion.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/lsp/handlers_completion.go b/internal/lsp/handlers_completion.go
index 28da503..6350c59 100644
--- a/internal/lsp/handlers_completion.go
+++ b/internal/lsp/handlers_completion.go
@@ -37,6 +37,18 @@ func (s *Server) handleCompletion(req Request) {
var p CompletionParams
var docStr string
if err := json.Unmarshal(req.Params, &p); err == nil {
+ // Skip completion for gitignored / extra-pattern-ignored files
+ if ignored, reason := s.isFileIgnored(p.TextDocument.URI); ignored {
+ logging.Logf("lsp ", "completion skipped: file ignored (%s) uri=%s", reason, p.TextDocument.URI)
+ if s.ignoreLSPNotifyEnabled() {
+ s.reply(req.ID, CompletionList{IsIncomplete: false, Items: []CompletionItem{
+ {Label: "[hexai] file ignored", Detail: reason},
+ }}, nil)
+ } else {
+ s.reply(req.ID, CompletionList{IsIncomplete: false, Items: nil}, nil)
+ }
+ return
+ }
// Log trigger information for every completion request from client
tk, tch := extractTriggerInfo(p)
logging.Logf("lsp ", "completion trigger kind=%d char=%q uri=%s line=%d char=%d",