summaryrefslogtreecommitdiff
path: root/internal/lsp/provider_native_success_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/lsp/provider_native_success_test.go')
-rw-r--r--internal/lsp/provider_native_success_test.go44
1 files changed, 23 insertions, 21 deletions
diff --git a/internal/lsp/provider_native_success_test.go b/internal/lsp/provider_native_success_test.go
index bfcb0b6..ac227be 100644
--- a/internal/lsp/provider_native_success_test.go
+++ b/internal/lsp/provider_native_success_test.go
@@ -63,31 +63,33 @@ func TestProviderNativeCompletion_IndentWithDoubleOpen(t *testing.T) {
type fakeCompleterCapture struct{ lastPrompt string }
-func (fakeCompleterCapture) Chat(context.Context, []llm.Message, ...llm.RequestOption) (string, error) { return "", nil }
+func (fakeCompleterCapture) Chat(context.Context, []llm.Message, ...llm.RequestOption) (string, error) {
+ return "", nil
+}
func (fakeCompleterCapture) Name() string { return "prov" }
func (fakeCompleterCapture) DefaultModel() string { return "m" }
func (f *fakeCompleterCapture) CodeCompletion(_ context.Context, prompt string, suffix string, n int, language string, temperature float64) ([]string, error) {
- f.lastPrompt = prompt
- return []string{"SUG"}, nil
+ f.lastPrompt = prompt
+ return []string{"SUG"}, nil
}
func TestProviderNativeCompletion_UsesPromptTemplate(t *testing.T) {
- s := newTestServer()
- cap := &fakeCompleterCapture{}
- s.llmClient = cap
- s.promptNativeCompletion = "NATIVE {{path}} {{before}}"
- uri := "file:///x.go"
- s.setDocument(uri, "AAA\nBBB\nCCC")
- current := "fmt."
- // Cursor at line 1, char 1 -> before should be "AAA\nB"
- p := CompletionParams{TextDocument: TextDocumentIdentifier{URI: uri}, Position: Position{Line: 1, Character: 1}}
- if _, ok := s.tryProviderNativeCompletion(current, p, "", "", "func f(){}", "doc", false, "", false); !ok {
- t.Fatalf("expected provider-native path")
- }
- if cap.lastPrompt == "" {
- t.Fatalf("expected captured prompt")
- }
- if cap.lastPrompt != "NATIVE /x.go AAA\nB" {
- t.Fatalf("unexpected prompt: %q", cap.lastPrompt)
- }
+ s := newTestServer()
+ cap := &fakeCompleterCapture{}
+ s.llmClient = cap
+ s.promptNativeCompletion = "NATIVE {{path}} {{before}}"
+ uri := "file:///x.go"
+ s.setDocument(uri, "AAA\nBBB\nCCC")
+ current := "fmt."
+ // Cursor at line 1, char 1 -> before should be "AAA\nB"
+ p := CompletionParams{TextDocument: TextDocumentIdentifier{URI: uri}, Position: Position{Line: 1, Character: 1}}
+ if _, ok := s.tryProviderNativeCompletion(current, p, "", "", "func f(){}", "doc", false, "", false); !ok {
+ t.Fatalf("expected provider-native path")
+ }
+ if cap.lastPrompt == "" {
+ t.Fatalf("expected captured prompt")
+ }
+ if cap.lastPrompt != "NATIVE /x.go AAA\nB" {
+ t.Fatalf("unexpected prompt: %q", cap.lastPrompt)
+ }
}