From 46068b8fbe8f1b2506a633cfb8e34965ad522e65 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Mon, 2 Feb 2026 08:52:20 -0300 Subject: [PATCH] fix(lsp): improve auto discovery (#2086) - ignore .git for autodiscovery - ignore LSPs with only .git as root marker Signed-off-by: Carlos Alexandro Becker --- internal/lsp/client.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/internal/lsp/client.go b/internal/lsp/client.go index 05ee570b9d5ad7a0d667b48084289bf0fe5d3dde..6c0059250c062c01ab3d541f4b0ca55ebf0b0cb6 100644 --- a/internal/lsp/client.go +++ b/internal/lsp/client.go @@ -591,12 +591,17 @@ func FilterMatching(dir string, servers map[string]*powernapconfig.ServerConfig) } normalized := make(map[string]serverPatterns, len(servers)) for name, server := range servers { - if len(server.RootMarkers) == 0 { - continue + var patterns []string + for _, p := range server.RootMarkers { + if p == ".git" { + // ignore .git for discovery + continue + } + patterns = append(patterns, filepath.ToSlash(p)) } - patterns := make([]string, len(server.RootMarkers)) - for i, p := range server.RootMarkers { - patterns[i] = filepath.ToSlash(p) + if len(patterns) == 0 { + slog.Debug("ignoring lsp with no root markers", "name", name) + continue } normalized[name] = serverPatterns{server: server, patterns: patterns} }