diff options
| author | Paul Buetow <paul@buetow.org> | 2025-08-22 19:19:55 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-08-22 19:19:55 +0300 |
| commit | 02603f6f33c89b796f5eff60d0406247db26d9e1 (patch) | |
| tree | 448fc85ac3dd3f839926d97f44c03a8313304dff | |
| parent | 90a9d57c05c033f19d0c233c8d0454708621d6b9 (diff) | |
lsp: inline prompt override does not trigger for bare ';;' (requires ';;text;'); add unit test
| -rw-r--r-- | internal/lsp/completion_prefix_strip_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
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) } +} |
