From b347431c72921c00a0f3cf5098b43baccc8394a3 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 12 Oct 2021 16:22:40 +0200 Subject: [PATCH] wip for adding language status for partial mode --- src/client/browser/extension.ts | 12 ++++++++++++ tsconfig.browser.json | 3 ++- types/vscode.proposed.d.ts | 28 ++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/client/browser/extension.ts b/src/client/browser/extension.ts index 284bf1300ada..efc1b114c4e5 100644 --- a/src/client/browser/extension.ts +++ b/src/client/browser/extension.ts @@ -109,6 +109,18 @@ async function runPylance( telemetryEvent.Exception, ); }); + + // show language status + const item = vscode.languages.createLanguageStatusItem('pylance.status', clientOptions.documentSelector!); + item.severity = vscode.LanguageStatusSeverity.Warning; + item.text = 'Partial Mode'; + item.detail = 'Project Wide IntelliSense not available'; // todo tweak wording, add "continue on"-link + item.command = { + title: 'Learn More', + command: 'vscode.open', + arguments: [vscode.Uri.parse('https://github.com/microsoft/vscode-python')], // todo define proper aka.ms-link + }; + context.subscriptions.push(item); }); const disposable = languageClient.start(); diff --git a/tsconfig.browser.json b/tsconfig.browser.json index d4aae7e98208..cda0a494e0f2 100644 --- a/tsconfig.browser.json +++ b/tsconfig.browser.json @@ -1,6 +1,7 @@ { "extends": "./tsconfig.json", "include": [ - "./src/client/browser" + "./src/client/browser", + "./types/vscode.proposed.d.ts" ] } diff --git a/types/vscode.proposed.d.ts b/types/vscode.proposed.d.ts index 3f817992a0ef..ee9965bb82ef 100644 --- a/types/vscode.proposed.d.ts +++ b/types/vscode.proposed.d.ts @@ -942,6 +942,34 @@ declare module 'vscode' { } //#endregion + + //#region https://github.com/microsoft/vscode/issues/129037 + + enum LanguageStatusSeverity { + Information = 0, + Warning = 1, + Error = 2 + } + + interface LanguageStatusItem { + readonly id: string; + selector: DocumentSelector; + // todo@jrieken replace with boolean ala needsAttention + severity: LanguageStatusSeverity; + name: string | undefined; + text: string; + detail?: string; + command: Command | undefined; + accessibilityInformation?: AccessibilityInformation; + dispose(): void; + } + + namespace languages { + export function createLanguageStatusItem(id: string, selector: DocumentSelector): LanguageStatusItem; + } + + //#endregion + //#region proposed test APIs https://github.com/microsoft/vscode/issues/107467 export namespace tests { /**