Skip to content

Commit 61882f7

Browse files
author
Kartik Raj
authored
Add quick pick hover support to explain conda environment lacking a Python interpreter (#21073)
Closes #20786
1 parent 8f8f624 commit 61882f7

File tree

5 files changed

+23
-6
lines changed

5 files changed

+23
-6
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"contribEditorContentMenu",
2222
"quickPickSortByLabel",
2323
"envShellEvent",
24-
"testObserver"
24+
"testObserver",
25+
"quickPickItemTooltip"
2526
],
2627
"author": {
2728
"name": "Microsoft Corporation"

src/client/common/utils/localize.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ export namespace Interpreters {
221221
}
222222

223223
export namespace InterpreterQuickPickList {
224+
export const condaEnvWithoutPythonTooltip = l10n.t(
225+
'Python is not available in this environment, it will automatically be installed upon selecting it',
226+
);
224227
export const noPythonInstalled = l10n.t('Python is not installed, please download and install it');
225228
export const clickForInstructions = l10n.t('Click for instructions...');
226229
export const globalGroupName = l10n.t('Global');

src/client/interpreter/configuration/interpreterSelector/commands/setInterpreter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ export class SetInterpreterCommand extends BaseInterpreterSelectorCommand implem
415415
if (isInterpreterQuickPickItem(item) && isProblematicCondaEnvironment(item.interpreter)) {
416416
if (!items[i].label.includes(Octicons.Warning)) {
417417
items[i].label = `${Octicons.Warning} ${items[i].label}`;
418+
items[i].tooltip = InterpreterQuickPickList.condaEnvWithoutPythonTooltip;
418419
}
419420
}
420421
});

src/client/interpreter/configuration/types.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@ export interface IInterpreterQuickPickItem extends QuickPickItem {
5252
interpreter: PythonEnvironment;
5353
}
5454

55-
export interface ISpecialQuickPickItem {
56-
label: string;
57-
description?: string;
58-
detail?: string;
59-
alwaysShow: boolean;
55+
export interface ISpecialQuickPickItem extends QuickPickItem {
6056
path?: string;
6157
}
6258

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
declare module 'vscode' {
7+
8+
// https://github.com/microsoft/vscode/issues/73904
9+
10+
export interface QuickPickItem {
11+
/**
12+
* An optional flag to sort the final results by index of first query match in label. Defaults to true.
13+
*/
14+
tooltip?: string | MarkdownString;
15+
}
16+
}

0 commit comments

Comments
 (0)