Compare commits
2 Commits
9b863168ff
...
4b486b2464
| Author | SHA1 | Date | |
|---|---|---|---|
| 4b486b2464 | |||
| 6111321fda |
39
index.ts
39
index.ts
@@ -244,26 +244,37 @@ async function runLsp(
|
||||
method: string,
|
||||
params: Record<string, unknown>,
|
||||
): Promise<unknown> {
|
||||
// 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);
|
||||
if (disabledServers.has(server.id)) {
|
||||
throw new Error(
|
||||
`LSP server "${server.id}" is disabled. Use /lsp-enable ${server.id} to re-enable.`,
|
||||
);
|
||||
}
|
||||
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);
|
||||
if (disabledServers.has(server.id)) {
|
||||
throw new Error(
|
||||
`LSP server "${server.id}" is disabled. Use /lsp-enable ${server.id} to re-enable.`,
|
||||
);
|
||||
}
|
||||
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
3752
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user