Add ability to suppress LSP error messages (#823)

This commit is contained in:
David Kincaid
2025-03-15 15:01:35 -04:00
committed by GitHub
parent 0da21f23a3
commit e38db288b7

View File

@@ -3,6 +3,7 @@ import * as path from "node:path";
import * as vscode from "vscode";
import {
LanguageClient,
MessageSignature,
type LanguageClientOptions,
type NotificationMessage,
type RequestMessage,
@@ -139,6 +140,22 @@ export default class GDScriptLanguageClient extends LanguageClient {
}
}
handleFailedRequest<T>(
type: MessageSignature,
token: vscode.CancellationToken | undefined,
error: any,
defaultValue: T,
showNotification?: boolean,
): T {
if (type.method === "textDocument/documentSymbol") {
if (error.message.includes("selectionRange must be contained in fullRange")) {
log.warn(`Request failed for method "${type.method}", suppressing notification - see issue #820`);
return super.handleFailedRequest(type, token, error, defaultValue, false);
}
}
return super.handleFailedRequest(type, token, error, defaultValue, showNotification);
}
private request_filter(message: RequestMessage) {
if (this.rejected) {
if (message.method === "shutdown") {