summaryrefslogtreecommitdiff
path: root/internal/lsp/handlers.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-08-22 17:10:58 +0300
committerPaul Buetow <paul@buetow.org>2025-08-22 17:10:58 +0300
commit529595010c347eb7f671a6028409f6e29fe4ffe7 (patch)
tree1d1ba77a90e73e085b37e76d3fc3d36302631b0c /internal/lsp/handlers.go
parent23c2fdd627704fbafec7a499c1ba94fdff876a96 (diff)
lsp: treat manual completion as trigger; remove space from default triggers; avoid auto after whitespace
Diffstat (limited to 'internal/lsp/handlers.go')
-rw-r--r--internal/lsp/handlers.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/lsp/handlers.go b/internal/lsp/handlers.go
index c39f359..f054cc9 100644
--- a/internal/lsp/handlers.go
+++ b/internal/lsp/handlers.go
@@ -735,7 +735,7 @@ func (s *Server) tryLLMCompletion(p CompletionParams, above, current, below, fun
allowNoPrefix := false
if idx > 0 {
ch := current[idx-1]
- if ch == '.' || ch == ':' || ch == '/' || ch == '_' || ch == ' ' {
+ if ch == '.' || ch == ':' || ch == '/' || ch == '_' {
allowNoPrefix = true
}
}
@@ -915,6 +915,10 @@ func (s *Server) isTriggerEvent(p CompletionParams, current string) bool {
b, _ := json.Marshal(p.Context)
_ = json.Unmarshal(b, &ctx)
}
+ // TriggerKind 1 = Invoked (manual) — always allow
+ if ctx.TriggerKind == 1 {
+ return true
+ }
// TriggerKind 2 is TriggerCharacter per LSP spec
if ctx.TriggerKind == 2 {
if ctx.TriggerCharacter != "" {
@@ -928,7 +932,7 @@ func (s *Server) isTriggerEvent(p CompletionParams, current string) bool {
// No character provided but reported as TriggerCharacter; be conservative
return false
}
- // For Invoked (1) or TriggerForIncomplete (3), require manual char check below
+ // For TriggerForIncomplete (3), require manual char check below
}
// 2) Fallback: check the character immediately prior to cursor
idx := p.Position.Character