feat(servers): split vscode-html-language-server and add css, json, bash, sql servers

- Split vscode-html-language-server into separate servers for HTML, CSS,
  and JSON with proper language IDs and file extensions
- Added bash-language-server for shell scripts (.sh, .bash)
- Added sqls for SQL files
- Added timeout wrapper to auto-check diagnostics to prevent blocking pi
This commit is contained in:
2026-05-08 18:51:12 -04:00
parent 46e3cc4ccd
commit e143e05758
2 changed files with 48 additions and 3 deletions

View File

@@ -334,6 +334,18 @@ function pickDiagnosticServers(filePath: string): string[] {
.map((s) => s.id);
}
// Timeout Wrapper - Rejects a promise after the given number of milliseconds.
// Used to prevent async hooks from blocking pi indefinitely.
function withTimeout<T>(promise: Promise<T>, ms: number): Promise<T> {
return new Promise((resolve, reject) => {
const timer = setTimeout(() => reject(new Error(`Timeout after ${ms}ms`)), ms);
promise.then(
(value) => { clearTimeout(timer); resolve(value); },
(reason) => { clearTimeout(timer); reject(reason); },
);
});
}
// Run LSP Diagnostics - Fans out to all matching servers in a single
// daemon call. Returns the grouped result map or undefined if no servers.
async function runDiagnostics(filePath: string): Promise<unknown> {
@@ -557,8 +569,9 @@ export default function (pi: ExtensionAPI) {
const absolutePath = path.resolve(ctx.cwd, filePath);
try {
// Run LSP diagnostics
const result = await runDiagnostics(absolutePath);
// Run LSP diagnostics with timeout - Prevent the auto-check hook from
// blocking pi if the daemon or LSP server is slow or unresponsive.
const result = await withTimeout(runDiagnostics(absolutePath), 3000);
const formatted = formatDiagnostics(result, 10);
// Only send a message if there are actual diagnostics