summaryrefslogtreecommitdiff
path: root/internal/lsp/completion_prefix_strip_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-08-22 19:29:41 +0300
committerPaul Buetow <paul@buetow.org>2025-08-22 19:29:41 +0300
commita04e510ee205c8f137636f0bd47263a64b047730 (patch)
tree2d2dc048466b2d686d8d0589d7a3dc668a54b625 /internal/lsp/completion_prefix_strip_test.go
parent02603f6f33c89b796f5eff60d0406247db26d9e1 (diff)
lsp: refine ';;text;' detection to require non-empty, non-space content and closing ';'; ensure bare ';;' and ';;;' do not auto-trigger; add tests
Diffstat (limited to 'internal/lsp/completion_prefix_strip_test.go')
-rw-r--r--internal/lsp/completion_prefix_strip_test.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/lsp/completion_prefix_strip_test.go b/internal/lsp/completion_prefix_strip_test.go
index 84f0568..43eb608 100644
--- a/internal/lsp/completion_prefix_strip_test.go
+++ b/internal/lsp/completion_prefix_strip_test.go
@@ -73,3 +73,10 @@ func TestTryLLMCompletion_DoubleSemicolonEmpty_DoesNotAutoTrigger(t *testing.T)
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) }
}
+
+func TestHasDoubleSemicolonTrigger_Variants(t *testing.T) {
+ if hasDoubleSemicolonTrigger(";;") { t.Fatalf("bare ';;' should not trigger") }
+ if hasDoubleSemicolonTrigger(";; ;") { t.Fatalf("';;' followed by space should not trigger") }
+ if hasDoubleSemicolonTrigger(";;;") { t.Fatalf("';;;' should not trigger (no content)") }
+ if !hasDoubleSemicolonTrigger(";;x;") { t.Fatalf("expected trigger for ';;x;' pattern") }
+}