summaryrefslogtreecommitdiff
path: root/internal/lsp/handlers_end_to_end_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-09-19 22:52:48 +0300
committerPaul Buetow <paul@buetow.org>2025-09-19 22:52:48 +0300
commiteb72b06fe8e62cb77af73f6dc558d384a5a5fe80 (patch)
treeefeb1165b9fbcb69a4ee675dba7bdc8c28fee3aa /internal/lsp/handlers_end_to_end_test.go
parentacc400768153a7bfda1413f15579c9455b877c87 (diff)
fix
Diffstat (limited to 'internal/lsp/handlers_end_to_end_test.go')
-rw-r--r--internal/lsp/handlers_end_to_end_test.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/lsp/handlers_end_to_end_test.go b/internal/lsp/handlers_end_to_end_test.go
index 32cb488..5489b97 100644
--- a/internal/lsp/handlers_end_to_end_test.go
+++ b/internal/lsp/handlers_end_to_end_test.go
@@ -73,6 +73,7 @@ func TestHandleCodeAction_ListsHexaiActions(t *testing.T) {
// Prepare server
var out bytes.Buffer
s := &Server{logger: log.New(io.Discard, "", 0), docs: make(map[string]*document), out: &out}
+ initServerDefaults(s)
s.chatSuffix = ">"
s.chatPrefixes = []string{"?", "!", ":", ";"}
s.llmClient = fakeLLM{resp: "// doc\nfunc add(a,b int) int { return a+b }"}
@@ -121,6 +122,7 @@ func TestHandleCodeAction_ListsHexaiActions(t *testing.T) {
func TestHandleCodeActionResolve_Document(t *testing.T) {
var out bytes.Buffer
s := &Server{logger: log.New(io.Discard, "", 0), docs: make(map[string]*document), out: &out}
+ initServerDefaults(s)
s.llmClient = fakeLLM{resp: "// doc\nfunc f(){}"}
uri := "file:///x.go"
s.setDocument(uri, "package p\nfunc f(){}\n")
@@ -152,6 +154,7 @@ func TestHandleCodeActionResolve_Document(t *testing.T) {
func TestHandleCodeAction_NoLLMOrEmptySelection_ReturnsEmpty(t *testing.T) {
var out bytes.Buffer
s := &Server{logger: log.New(io.Discard, "", 0), docs: make(map[string]*document), out: &out}
+ initServerDefaults(s)
uri := "file:///x.go"
s.setDocument(uri, "package p\n\n")
// Empty selection
@@ -187,6 +190,7 @@ func mustJSON(v any) json.RawMessage { b, _ := json.Marshal(v); return b }
func TestHandle_UnknownMethod_ReturnsError(t *testing.T) {
var out bytes.Buffer
s := &Server{logger: log.New(io.Discard, "", 0), docs: make(map[string]*document), out: &out, handlers: map[string]func(Request){}}
+ initServerDefaults(s)
req := Request{JSONRPC: "2.0", ID: json.RawMessage("9"), Method: "no/such"}
out.Reset()
s.handle(req)
@@ -253,6 +257,7 @@ func TestDetectAndHandleChat_InsertsReply(t *testing.T) {
func TestHandleCodeActionResolve_Diagnostics(t *testing.T) {
var out bytes.Buffer
s := &Server{logger: log.New(io.Discard, "", 0), docs: make(map[string]*document), out: &out}
+ initServerDefaults(s)
s.llmClient = fakeLLM{resp: "fixed"}
uri := "file:///x.go"
s.setDocument(uri, "package p\nvar x = 1\n")