Compare commits

..

2 Commits

Author SHA1 Message Date
4b486b2464 build: add pi-coding-agent and typebox dev dependencies
Resolve 47 of 52 LSP diagnostics: module-not-found errors for
@mariozechner/pi-coding-agent and typebox, plus cascading implicit-any
errors on callback parameters. Both packages are available on npm and
provided at runtime by pi.
2026-05-02 00:46:46 -04:00
6111321fda fix(extension): suppress warnings for unsupported file types and missing binaries
Move pickServer() into the try-catch in runLsp() so UnsupportedExtensionError
is caught directly. Add message-based fallback in both runLsp() and
runDiagnostics() to handle daemon-wrapped errors that come through as plain
Error instances rather than the original typed exception.

This eliminates spurious 'No LSP server registered' warnings during auto-check
after edit/write on files without LSP support (e.g. .md, .txt, .sh).
2026-05-02 00:42:44 -04:00
3 changed files with 3784 additions and 9 deletions

View File

@@ -244,6 +244,7 @@ async function runLsp(
method: string,
params: Record<string, unknown>,
): Promise<unknown> {
try {
// Check Disabled - The server for this file is blocked; bail before
// touching the daemon so other pi instances sharing it are unaffected.
const server = pickServer(filePath);
@@ -252,18 +253,28 @@ async function runLsp(
`LSP server "${server.id}" is disabled. Use /lsp-enable ${server.id} to re-enable.`,
);
}
try {
return await daemonRequest(filePath, method, params);
} catch (error) {
if (isExpectedError(error)) {
return undefined;
}
// Daemon-wrapped errors (plain Error with expected message) are also
// expected — the daemon catches pickServer() throws and returns them
// as string error messages.
if (
error instanceof Error &&
(error.message.includes("No LSP server registered") ||
error.message.includes("not found on PATH"))
) {
return undefined;
}
throw error;
}
}
// Run LSP Diagnostics - Diagnostics arrive as a notification, so the
// daemon has a dedicated op that waits for the next publish.
// daemon has a dedicated op that waits for the next publish. Expected
// errors (unsupported file type, missing binary) are suppressed.
async function runDiagnostics(filePath: string): Promise<unknown> {
try {
return await daemonDiagnostics(filePath, 1500);
@@ -271,6 +282,16 @@ async function runDiagnostics(filePath: string): Promise<unknown> {
if (isExpectedError(error)) {
return undefined;
}
// Daemon-wrapped errors (plain Error with expected message) are also
// expected — the daemon catches pickServer() throws and returns them
// as string error messages.
if (
error instanceof Error &&
(error.message.includes("No LSP server registered") ||
error.message.includes("not found on PATH"))
) {
return undefined;
}
throw error;
}
}

3752
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -25,9 +25,11 @@
"vscode-languageserver-protocol": "^3.17.5"
},
"devDependencies": {
"@mariozechner/pi-coding-agent": "^0.72.0",
"@types/node": "^22.10.0",
"oxlint": "^1.62.0",
"tsx": "^4.19.2",
"typebox": "^1.1.37",
"typescript": "^6.0.3"
}
}