on main help sign in
fix(lsp): clone slice to avoid mutation
baae1b6Andrey Nering
internal/lsp/client.go+2−1
@@ -8,6 +8,7 @@ import (
8 "maps"
8 "maps"
9 "os"
9 "os"
10 "path/filepath"
10 "path/filepath"
11+ "slices"
11 "sync"
12 "sync"
12 "sync/atomic"
13 "sync/atomic"
13 "time"
14 "time"
@@ -288,7 +289,7 @@ func (c *Client) GetName() string {
288
289
289// FileTypes returns the file types this LSP client handles
290// FileTypes returns the file types this LSP client handles
290func (c *Client) FileTypes() []string {
291func (c *Client) FileTypes() []string {
291− return c.fileTypes
292+ return slices.Clone(c.fileTypes)
292}
293}
293
294
294// SetDiagnosticsCallback sets the callback function for diagnostic changes
295// SetDiagnosticsCallback sets the callback function for diagnostic changes