From 02603f6f33c89b796f5eff60d0406247db26d9e1 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 22 Aug 2025 19:19:55 +0300 Subject: lsp: inline prompt override does not trigger for bare ';;' (requires ';;text;'); add unit test --- internal/lsp/completion_prefix_strip_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/internal/lsp/completion_prefix_strip_test.go b/internal/lsp/completion_prefix_strip_test.go index 199838f..84f0568 100644 --- a/internal/lsp/completion_prefix_strip_test.go +++ b/internal/lsp/completion_prefix_strip_test.go @@ -61,3 +61,15 @@ func TestTryLLMCompletion_InlineSemicolonPromptAlwaysTriggers(t *testing.T) { if busy { t.Fatalf("unexpected busy=true") } if !ok || len(items) == 0 { t.Fatalf("expected completion to trigger on inline ;text; prompt") } } + +func TestTryLLMCompletion_DoubleSemicolonEmpty_DoesNotAutoTrigger(t *testing.T) { + s := &Server{ maxTokens: 32, triggerChars: []string{".", ":", "/", "_"}, compCache: make(map[string]string) } + fake := &countingLLM{} + s.llmClient = fake + line := ";; " // empty content after ';;' should not force-trigger + p := CompletionParams{ Position: Position{ Line: 0, Character: len(line) }, TextDocument: TextDocumentIdentifier{URI: "file://empty-inline.go"} } + items, ok, _ := s.tryLLMCompletion(p, "", line, "", "", "", false, "") + if !ok { t.Fatalf("expected ok=true for non-trigger path") } + if len(items) != 0 { t.Fatalf("expected no items when inline ';;' is empty") } + if fake.calls != 0 { t.Fatalf("LLM should not be called; calls=%d", fake.calls) } +} -- cgit v1.2.3