Skip to content

Commit 699b190

Browse files
author
Kartik Raj
committed
Simulate pinning version in status bar
1 parent 353792c commit 699b190

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/client/interpreter/display/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ import {
1414
IInterpreterStatusbarVisibilityFilter,
1515
} from '../contracts';
1616

17+
/**
18+
* Based on https://github.com/microsoft/vscode-python/issues/18040#issuecomment-992567670.
19+
* This is to ensure the item appears right after the Python language status item.
20+
*/
21+
const STATUS_BAR_ITEM_PRIORITY = 100.09999;
1722
@injectable()
1823
export class InterpreterDisplay implements IInterpreterDisplay {
1924
private readonly statusBar: StatusBarItem;
@@ -36,7 +41,7 @@ export class InterpreterDisplay implements IInterpreterDisplay {
3641
const application = serviceContainer.get<IApplicationShell>(IApplicationShell);
3742
const disposableRegistry = serviceContainer.get<Disposable[]>(IDisposableRegistry);
3843

39-
this.statusBar = application.createStatusBarItem(StatusBarAlignment.Right, 100);
44+
this.statusBar = application.createStatusBarItem(StatusBarAlignment.Right, STATUS_BAR_ITEM_PRIORITY);
4045
this.statusBar.command = 'python.setInterpreter';
4146
disposableRegistry.push(this.statusBar);
4247

@@ -83,7 +88,7 @@ export class InterpreterDisplay implements IInterpreterDisplay {
8388
);
8489
this.interpreterPath = interpreter.path;
8590
}
86-
this.statusBar.text = interpreter.displayName!;
91+
this.statusBar.text = interpreter.displayName!.substring('Python '.length);
8792
this.currentlySelectedInterpreterPath = interpreter.path;
8893
} else {
8994
this.statusBar.tooltip = '';

0 commit comments

Comments
 (0)