on 94de6bc help sign in
crush/internal/config/lsp_defaults_test.go
35 lines 935 B history raw
1package config
3import (
4 "testing"
6 "github.com/stretchr/testify/require"
7)
9func TestApplyLSPDefaults(t *testing.T) {
10 t.Parallel()
12 // Create a config with an LSP that should get defaults
13 config := &Config{
14 LSP: map[string]LSPConfig{
15 "gopls": {
16 Command: "gopls", // This should get defaults from powernap
17 },
18 "custom": {
19 Command: "custom-lsp",
20 RootMarkers: []string{"custom.toml"}, // This should keep its explicit config
21 },
22 },
23 }
25 // Apply defaults
26 config.applyLSPDefaults()
28 // Check that gopls got defaults (it should have some root markers now)
29 goplsConfig := config.LSP["gopls"]
30 require.NotEmpty(t, goplsConfig.RootMarkers, "gopls should have received default root markers")
32 // Check that custom LSP kept its explicit config
33 customConfig := config.LSP["custom"]
34 require.Equal(t, []string{"custom.toml"}, customConfig.RootMarkers, "custom LSP should keep its explicit root markers")