Compare commits
2 Commits
9b863168ff
...
4b486b2464
| Author | SHA1 | Date | |
|---|---|---|---|
| 4b486b2464 | |||
| 6111321fda |
25
index.ts
25
index.ts
@@ -244,6 +244,7 @@ async function runLsp(
|
|||||||
method: string,
|
method: string,
|
||||||
params: Record<string, unknown>,
|
params: Record<string, unknown>,
|
||||||
): Promise<unknown> {
|
): Promise<unknown> {
|
||||||
|
try {
|
||||||
// Check Disabled - The server for this file is blocked; bail before
|
// Check Disabled - The server for this file is blocked; bail before
|
||||||
// touching the daemon so other pi instances sharing it are unaffected.
|
// touching the daemon so other pi instances sharing it are unaffected.
|
||||||
const server = pickServer(filePath);
|
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.`,
|
`LSP server "${server.id}" is disabled. Use /lsp-enable ${server.id} to re-enable.`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
return await daemonRequest(filePath, method, params);
|
return await daemonRequest(filePath, method, params);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (isExpectedError(error)) {
|
if (isExpectedError(error)) {
|
||||||
return undefined;
|
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;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run LSP Diagnostics - Diagnostics arrive as a notification, so the
|
// 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> {
|
async function runDiagnostics(filePath: string): Promise<unknown> {
|
||||||
try {
|
try {
|
||||||
return await daemonDiagnostics(filePath, 1500);
|
return await daemonDiagnostics(filePath, 1500);
|
||||||
@@ -271,6 +282,16 @@ async function runDiagnostics(filePath: string): Promise<unknown> {
|
|||||||
if (isExpectedError(error)) {
|
if (isExpectedError(error)) {
|
||||||
return undefined;
|
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;
|
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"
|
"vscode-languageserver-protocol": "^3.17.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@mariozechner/pi-coding-agent": "^0.72.0",
|
||||||
"@types/node": "^22.10.0",
|
"@types/node": "^22.10.0",
|
||||||
"oxlint": "^1.62.0",
|
"oxlint": "^1.62.0",
|
||||||
"tsx": "^4.19.2",
|
"tsx": "^4.19.2",
|
||||||
|
"typebox": "^1.1.37",
|
||||||
"typescript": "^6.0.3"
|
"typescript": "^6.0.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user