1package config
 2
 3import (
 4	"testing"
 5
 6	"github.com/stretchr/testify/require"
 7)
 8
 9func TestApplyLSPDefaults(t *testing.T) {
10	t.Parallel()
11
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	}
24
25	// Apply defaults
26	config.applyLSPDefaults()
27
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")
31
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")
35}