diff options
| author | Paul Buetow <paul@buetow.org> | 2025-08-16 17:05:24 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-08-16 17:05:24 +0300 |
| commit | 778a3591bd27ce49acb6f8596f3c714351c412dc (patch) | |
| tree | d4617e94d9543532b82d63021e6e8d1ae272eeb1 /internal/lsp/handlers_test.go | |
| parent | ad62a3eb132924858d23694273923f1fc13ca22e (diff) | |
lsp/completion: strip inline ;...; prompt markers via AdditionalTextEdits; update tests
Diffstat (limited to 'internal/lsp/handlers_test.go')
| -rw-r--r-- | internal/lsp/handlers_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/lsp/handlers_test.go b/internal/lsp/handlers_test.go index ecd9de6..6ce1e5d 100644 --- a/internal/lsp/handlers_test.go +++ b/internal/lsp/handlers_test.go @@ -126,3 +126,24 @@ func TestComputeTextEditAndFilter_NoParensFallback(t *testing.T) { func contains(s, sub string) bool { return len(s) >= len(sub) && (func() bool { i := 0; for i+len(sub) <= len(s) { if s[i:i+len(sub)] == sub { return true }; i++ }; return false })() } + + +func TestCollectPromptRemovalEdits(t *testing.T) { + s := newTestServer() + uri := "file:///x.go" + src := `keep ;tag; this and ;another; that +no markers here` + s.setDocument(uri, src) + edits := s.collectPromptRemovalEdits(uri) + if len(edits) != 2 { + t.Fatalf("expected 2 edits, got %d", len(edits)) + } + // First occurrence ;tag; + e0 := edits[0] + if e0.Range.Start.Line != 0 { + t.Fatalf("e0 start line=%d want 0", e0.Range.Start.Line) + } + if s.getDocument(uri).lines[0][e0.Range.Start.Character:e0.Range.Start.Character+1] != ";" { + t.Fatalf("e0 start not at ;") + } +} |
