summaryrefslogtreecommitdiff
path: root/internal/lsp/provider_native_success_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-09-06 10:25:36 +0300
committerPaul Buetow <paul@buetow.org>2025-09-06 10:25:36 +0300
commit5be9532cfa630f4aacd8d879c3e4f5cc316da0fa (patch)
tree0a901680fccd1e2703ffdbd9284ccff932be1d67 /internal/lsp/provider_native_success_test.go
parent70f1d0e78c57dfa5beae779b3d392b6e6fa44c14 (diff)
feat(lsp): configurable inline/chat triggers; switch inline markers to >text>/>>text>; update docs and example config; tests updated to new triggers and raise LSP coverage to >=85%; chore: remove semicolon legacy; chore(mage): auto-refresh coverage daily if docs/coverage.out is older than 24h
Diffstat (limited to 'internal/lsp/provider_native_success_test.go')
-rw-r--r--internal/lsp/provider_native_success_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/lsp/provider_native_success_test.go b/internal/lsp/provider_native_success_test.go
index 7db3844..fd7afad 100644
--- a/internal/lsp/provider_native_success_test.go
+++ b/internal/lsp/provider_native_success_test.go
@@ -31,3 +31,24 @@ func TestProviderNativeCompletion_Success(t *testing.T) {
}
}
+type fakeCompleterIndent struct{}
+
+func (fakeCompleterIndent) Chat(context.Context, []llm.Message, ...llm.RequestOption) (string, error) { return "", nil }
+func (fakeCompleterIndent) Name() string { return "prov" }
+func (fakeCompleterIndent) DefaultModel() string { return "m" }
+func (fakeCompleterIndent) CodeCompletion(context.Context, string, string, int, string, float64) ([]string, error) {
+ return []string{"a\nb"}, nil
+}
+
+func TestProviderNativeCompletion_IndentWithDoubleOpen(t *testing.T) {
+ s := newTestServer()
+ s.llmClient = fakeCompleterIndent{}
+ current := " >>do>" // leading indent + double-open marker
+ p := CompletionParams{TextDocument: TextDocumentIdentifier{URI: "file:///x.go"}, Position: Position{Line: 0, Character: len(current)}}
+ items, ok := s.tryProviderNativeCompletion(current, p, "", "", "func f(){}", "doc", false, "", false)
+ if !ok || len(items) == 0 { t.Fatalf("expected provider-native items") }
+ if items[0].TextEdit == nil { t.Fatalf("expected text edit") }
+ if got := items[0].TextEdit.NewText; len(got) < 2 || got[:2] != " " {
+ t.Fatalf("expected indentation applied, got %q", got)
+ }
+}