fix(lsp): improve code quality in directory diagnostics

- Dedupe directory-checking logic: findWorkspaceRoot now uses isDirectoryPath helper
- Add early return when no files match extension to avoid starting LSP server unnecessarily
This commit is contained in:
acamq
2026-03-08 16:56:33 -06:00
parent 858b10df6f
commit ecdc835b13
2 changed files with 21 additions and 12 deletions
+9
View File
@@ -84,6 +84,15 @@ export async function aggregateDiagnosticsForDirectory(
const wasCapped = allFiles.length > maxFiles
const filesToProcess = allFiles.slice(0, maxFiles)
if (filesToProcess.length === 0) {
return [
`Directory: ${absDir}`,
`Extension: ${extension}`,
`Files scanned: 0`,
`No files found with extension "${extension}".`,
].join("\n")
}
const root = findWorkspaceRoot(absDir)
const allDiagnostics: Diagnostic[] = []