MCPcopy Create free account
hub / github.com/diillson/chatcli / TestServerForFile

Function TestServerForFile

cli/agent/lsp/lsp_test.go:38–52  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

36}
37
38func TestServerForFile(t *testing.T) {
39 spec, ok := ServerForFile("/path/main.go")
40 if !ok || spec.LanguageID != "go" || spec.Command[0] != "gopls" {
41 t.Errorf("go spec wrong: %+v ok=%v", spec, ok)
42 }
43 if _, ok := ServerForFile("/path/file.unknown"); ok {
44 t.Error("unknown extension should not match")
45 }
46
47 t.Setenv("CHATCLI_LSP_GO_CMD", "gopls -rpc.trace")
48 spec, _ = ServerForFile("x.go")
49 if len(spec.Command) != 2 || spec.Command[1] != "-rpc.trace" {
50 t.Errorf("env override not applied: %+v", spec.Command)
51 }
52}
53
54// fakeServer speaks just enough LSP to answer initialize and emit diagnostics
55// on didOpen.

Callers

nothing calls this directly

Calls 3

ServerForFileFunction · 0.85
ErrorfMethod · 0.80
ErrorMethod · 0.65

Tested by

no test coverage detected