on main help sign in
fix(lsp): replace recursive fastwalk with filepath.Glob in root marker detection (#2316)

hasRootMarkers used fsext.Glob which triggered a full recursive fastwalk of the working directory with no gitignore filtering. In large JS monorepos this walked millions of files in node_modules, causing 800% CPU usage. Root markers are simple filenames (go.mod, package.json, *.gpr, etc.) that only need a single-directory check. ๐Ÿ˜ Generated with Crush Assisted-by: AWS Claude Opus 4.6 via Crush <crush@charm.land>

commit24f99f0d93aa9b71abb72ef8c89bc939cca71b78 authorAustin Cherry <acmacalister@gmail.com> dateThu 26 Feb 2026, 13:42 (8 months ago) parentc6f8546
1 file changed+4โˆ’2
internal/lsp/manager.go+4โˆ’2
internal/lsp/manager.go+4โˆ’2
@@ -303,8 +303,10 @@ func hasRootMarkers(dir string, markers []string) bool {
303303 return true
304304 }
305305 for _, pattern := range markers {
306โˆ’ // Use fsext.GlobWithDoubleStar to find matches
307โˆ’ matches, _, err := fsext.Glob(pattern, dir, 1)
306+ // Use filepath.Glob for a non-recursive check in the root
307+ // directory. This avoids walking the entire tree (which is
308+ // catastrophic in large monorepos with node_modules, etc.).
309+ matches, err := filepath.Glob(filepath.Join(dir, pattern))
308310 if err == nil && len(matches) > 0 {
309311 return true
310312 }