Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add quick pick hover support to explain conda environment lacking a Python interpreter #21073

Merged
merged 3 commits into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"contribEditorContentMenu",
"quickPickSortByLabel",
"envShellEvent",
"testObserver"
"testObserver",
"quickPickItemTooltip"
],
"author": {
"name": "Microsoft Corporation"
Expand Down
3 changes: 3 additions & 0 deletions src/client/common/utils/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ export namespace Interpreters {
}

export namespace InterpreterQuickPickList {
export const condaEnvWithoutPythonTooltip = l10n.t(
'Python is not available in this environment, it will automatically be installed upon selecting it',
);
export const noPythonInstalled = l10n.t('Python is not installed, please download and install it');
export const clickForInstructions = l10n.t('Click for instructions...');
export const globalGroupName = l10n.t('Global');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ export class SetInterpreterCommand extends BaseInterpreterSelectorCommand implem
if (isInterpreterQuickPickItem(item) && isProblematicCondaEnvironment(item.interpreter)) {
if (!items[i].label.includes(Octicons.Warning)) {
items[i].label = `${Octicons.Warning} ${items[i].label}`;
items[i].tooltip = InterpreterQuickPickList.condaEnvWithoutPythonTooltip;
}
}
});
Expand Down
6 changes: 1 addition & 5 deletions src/client/interpreter/configuration/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ export interface IInterpreterQuickPickItem extends QuickPickItem {
interpreter: PythonEnvironment;
}

export interface ISpecialQuickPickItem {
label: string;
description?: string;
detail?: string;
alwaysShow: boolean;
export interface ISpecialQuickPickItem extends QuickPickItem {
path?: string;
}

Expand Down
16 changes: 16 additions & 0 deletions typings/vscode-proposed/vscode.proposed.quickPickItemTooltip.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

declare module 'vscode' {

// https://github.com/microsoft/vscode/issues/73904

export interface QuickPickItem {
/**
* An optional flag to sort the final results by index of first query match in label. Defaults to true.
*/
tooltip?: string | MarkdownString;
}
}