feat: warm-start LSP server on file read

This commit is contained in:
2026-04-30 11:10:36 -04:00
parent aa7309b363
commit 620d9cc70f

View File

@@ -432,6 +432,25 @@ export default function (pi: ExtensionAPI) {
default: true,
});
// Background Init on Read - Fire-and-forget LSP initialization when the
// LLM reads a file with a supported extension. Doesn't block the read,
// just ensures the server is warm by the time an LSP tool is called.
pi.on("tool_result", async (event, ctx) => {
if (event.toolName !== "read" || event.isError) return;
const filePath = event.input?.path;
if (!filePath || typeof filePath !== "string") return;
try {
const absolutePath = path.resolve(ctx.cwd, filePath);
// daemonDiagnostics triggers getOrCreateEntry + syncFile in the daemon.
// We don't await it — just fire and forget so the server starts warming up.
void daemonDiagnostics(absolutePath);
} catch {
// Silently ignore — unsupported file type, missing binary, etc.
}
});
// Auto-Check After Edit/Write - Run diagnostics automatically
pi.on("tool_result", async (event, ctx) => {
// Check Enabled