From 504abf42e4dc5611c5088f11146fe92ca2afa661 Mon Sep 17 00:00:00 2001 From: detachhead Date: Wed, 14 Aug 2024 11:04:00 +1000 Subject: [PATCH] don't report "Unhandled method workspace/configuration" error as a notification, workaround for #573 --- .../pyright-internal/src/realLanguageServer.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/pyright-internal/src/realLanguageServer.ts b/packages/pyright-internal/src/realLanguageServer.ts index 3772f9ba69..3b1298c689 100644 --- a/packages/pyright-internal/src/realLanguageServer.ts +++ b/packages/pyright-internal/src/realLanguageServer.ts @@ -213,10 +213,16 @@ export abstract class RealLanguageServer extends LanguageServerBase { } } } catch (error) { - this.connection.sendNotification(ShowMessageNotification.type, { - message: error instanceof Error ? error.message : error, - type: MessageType.Error, - }); + const errorMessage = error instanceof Error ? error.message : error; + // workaround for https://github.com/DetachHead/basedpyright/issues/573 + if (errorMessage === 'Unhandled method workspace/configuration') { + this.console.error(`Error reading settings: ${error}`); + } else { + this.connection.sendNotification(ShowMessageNotification.type, { + message: errorMessage, + type: MessageType.Error, + }); + } } return serverSettings; }