Skip to content

Commit ee77dbd

Browse files
authored
change hover on tooltip to show full env path (#577)
fixes #575
1 parent da8c1e4 commit ee77dbd

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

src/features/views/pythonStatusBar.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { Disposable, StatusBarAlignment, StatusBarItem, ThemeColor } from 'vscode';
2+
import { PythonEnvironment } from '../../api';
23
import { createStatusBarItem } from '../../common/window.apis';
34

45
export interface PythonStatusBar extends Disposable {
5-
show(text?: string): void;
6+
show(env?: PythonEnvironment): void;
67
hide(): void;
78
}
89

@@ -19,9 +20,15 @@ export class PythonStatusBarImpl implements Disposable {
1920
this.disposables.push(this.statusBarItem);
2021
}
2122

22-
public show(text?: string) {
23-
this.statusBarItem.text = text ?? 'Select Python Interpreter';
24-
this.statusBarItem.backgroundColor = text ? undefined : new ThemeColor('statusBarItem.warningBackground');
23+
public show(env?: PythonEnvironment) {
24+
if (env) {
25+
this.statusBarItem.text = env.displayName ?? 'Select Python Interpreter';
26+
this.statusBarItem.tooltip = env.environmentPath?.fsPath ?? '';
27+
} else {
28+
this.statusBarItem.text = 'Select Python Interpreter';
29+
this.statusBarItem.tooltip = 'Select Python Interpreter';
30+
}
31+
this.statusBarItem.backgroundColor = env ? undefined : new ThemeColor('statusBarItem.warningBackground');
2532
this.statusBarItem.show();
2633
}
2734

src/features/views/revealHandler.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import { PythonEnvironmentApi } from '../../api';
2+
import { isPythonProjectFile } from '../../common/utils/fileNameUtils';
13
import { activeTextEditor } from '../../common/window.apis';
2-
import { ProjectView } from './projectView';
34
import { EnvManagerView } from './envManagersView';
5+
import { ProjectView } from './projectView';
46
import { PythonStatusBar } from './pythonStatusBar';
5-
import { isPythonProjectFile } from '../../common/utils/fileNameUtils';
6-
import { PythonEnvironmentApi } from '../../api';
77

88
export function updateViewsAndStatus(
99
statusBar: PythonStatusBar,
@@ -31,7 +31,7 @@ export function updateViewsAndStatus(
3131
workspaceView.reveal(activeDocument.uri);
3232
setImmediate(async () => {
3333
const env = await api.getEnvironment(activeDocument.uri);
34-
statusBar.show(env?.displayName);
34+
statusBar.show(env);
3535
managerView.reveal(env);
3636
});
3737
}

0 commit comments

Comments
 (0)