Skip to content

Commit 96d3257

Browse files
authored
bug: reduce noise in the environments view (#183)
Fixes #182
1 parent ba76736 commit 96d3257

7 files changed

Lines changed: 22 additions & 18 deletions

File tree

src/features/views/treeViewItems.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ export class EnvManagerTreeItem implements EnvTreeItem {
3131
constructor(public readonly manager: InternalEnvironmentManager) {
3232
const item = new TreeItem(manager.displayName, TreeItemCollapsibleState.Collapsed);
3333
item.contextValue = this.getContextValue();
34-
// Descriptions were a bit too visually noisy
35-
// https://github.com/microsoft/vscode-python-environments/issues/167
36-
item.description = undefined;
34+
item.description = manager.description;
3735
item.tooltip = manager.tooltip ?? manager.description;
3836
item.iconPath = manager.iconPath;
3937
this.treeItem = item;
@@ -72,12 +70,11 @@ export class PythonEnvTreeItem implements EnvTreeItem {
7270
public readonly selected?: string,
7371
) {
7472
let name = environment.displayName ?? environment.name;
75-
let tooltip = environment.tooltip;
73+
let tooltip = environment.tooltip ?? environment.description;
7674
if (selected) {
77-
const tooltipEnd = environment.tooltip ?? environment.description;
78-
tooltip =
75+
const selectedTooltip =
7976
selected === 'global' ? EnvViewStrings.selectedGlobalTooltip : EnvViewStrings.selectedWorkspaceTooltip;
80-
tooltip = tooltipEnd ? `${tooltip}${tooltipEnd}` : tooltip;
77+
tooltip = tooltip ? `${selectedTooltip}${tooltip}` : tooltip;
8178
}
8279

8380
const item = new TreeItem(name, TreeItemCollapsibleState.Collapsed);

src/managers/builtin/sysPythonManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class SysPythonManager implements EnvironmentManager {
4343
public readonly name: string;
4444
public readonly displayName: string;
4545
public readonly preferredPackageManagerId: string;
46-
public readonly description: string;
46+
public readonly description: string | undefined;
4747
public readonly tooltip: string | MarkdownString;
4848
public readonly iconPath: IconPath;
4949

@@ -55,7 +55,7 @@ export class SysPythonManager implements EnvironmentManager {
5555
this.name = 'system';
5656
this.displayName = 'Global';
5757
this.preferredPackageManagerId = 'ms-python.python:pip';
58-
this.description = SysManagerStrings.sysManagerDescription;
58+
this.description = undefined;
5959
this.tooltip = new MarkdownString(SysManagerStrings.sysManagerDescription, true);
6060
this.iconPath = new ThemeIcon('globe');
6161
}

src/managers/builtin/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ function getPythonInfo(env: NativeEnvInfo): PythonEnvironmentInfo {
8181
shortDisplayName: shortDisplayName,
8282
displayPath: env.executable,
8383
version: env.version,
84-
description: env.executable,
84+
description: undefined,
85+
tooltip: env.executable,
8586
environmentPath: Uri.file(env.executable),
8687
iconPath: new ThemeIcon('globe'),
8788
sysPrefix: env.prefix,

src/managers/builtin/venvManager.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ export class VenvManager implements EnvironmentManager {
6262
) {
6363
this.name = 'venv';
6464
this.displayName = 'venv';
65-
this.description = VenvManagerStrings.venvManagerDescription;
65+
// Descriptions were a bit too visually noisy
66+
// https://github.com/microsoft/vscode-python-environments/issues/167
67+
this.description = undefined;
6668
this.tooltip = new MarkdownString(VenvManagerStrings.venvManagerDescription, true);
6769
this.preferredPackageManagerId = 'ms-python.python:pip';
6870
this.iconPath = new ThemeIcon('python');

src/managers/builtin/venvUtils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ async function getPythonInfo(env: NativeEnvInfo): Promise<PythonEnvironmentInfo>
236236
shortDisplayName: `${sv} (${venvName})`,
237237
displayPath: env.executable,
238238
version: env.version,
239-
description: env.executable,
239+
description: undefined,
240+
tooltip: env.executable,
240241
environmentPath: Uri.file(env.executable),
241242
iconPath: new ThemeIcon('python'),
242243
sysPrefix: env.prefix,

src/managers/conda/condaEnvManager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ export class CondaEnvManager implements EnvironmentManager, Disposable {
5353
this.name = 'conda';
5454
this.displayName = 'Conda';
5555
this.preferredPackageManagerId = 'ms-python.python:conda';
56-
this.description = CondaStrings.condaManager;
57-
this.tooltip = CondaStrings.condaManager;
56+
this.description = undefined;
57+
this.tooltip = new MarkdownString(CondaStrings.condaManager, true);
5858
}
5959

6060
name: string;
6161
displayName: string;
6262
preferredPackageManagerId: string = 'ms-python.python:conda';
63-
description: string;
63+
description: string | undefined;
6464
tooltip: string | MarkdownString;
6565
iconPath?: IconPath;
6666

src/managers/conda/condaUtils.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ function nativeToPythonEnv(
270270
displayName: `base (${sv})`,
271271
shortDisplayName: `base:${sv}`,
272272
displayPath: e.name,
273-
description: e.prefix,
273+
description: undefined,
274+
tooltip: e.prefix,
274275
version: e.version,
275276
sysPrefix: e.prefix,
276277
execInfo: {
@@ -302,7 +303,8 @@ function nativeToPythonEnv(
302303
displayName: `${basename} (${sv})`,
303304
shortDisplayName: `${basename}:${sv}`,
304305
displayPath: e.prefix,
305-
description: e.prefix,
306+
description: undefined,
307+
tooltip: e.prefix,
306308
version: e.version,
307309
sysPrefix: e.prefix,
308310
execInfo: {
@@ -340,7 +342,8 @@ function nativeToPythonEnv(
340342
displayName: `${name} (${sv})`,
341343
shortDisplayName: `${name}:${sv}`,
342344
displayPath: e.prefix,
343-
description: e.prefix,
345+
description: undefined,
346+
tooltip: e.prefix,
344347
version: e.version,
345348
sysPrefix: e.prefix,
346349
execInfo: {

0 commit comments

Comments
 (0)