(t *testing.T)
| 36 | } |
| 37 | |
| 38 | func 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. |
nothing calls this directly
no test coverage detected