From 529595010c347eb7f671a6028409f6e29fe4ffe7 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 22 Aug 2025 17:10:58 +0300 Subject: lsp: treat manual completion as trigger; remove space from default triggers; avoid auto after whitespace --- internal/lsp/handlers.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'internal/lsp/handlers.go') 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 -- cgit v1.2.3