Skip to content

Commit 4160322

Browse files
committed
sort interpreters to display envs on top
1 parent 42f2538 commit 4160322

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/client/providers/setInterpreterProvider.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,18 @@ function setPythonPath(pythonPath: string, created: boolean = false) {
219219
}
220220

221221
function presentQuickPickOfSuggestedPythonPaths() {
222-
const currentPythonPath = settings.PythonSettings.getInstance().pythonPath;
222+
let currentPythonPath = settings.PythonSettings.getInstance().pythonPath;
223+
if (currentPythonPath.startsWith(vscode.workspace.rootPath)) {
224+
currentPythonPath = `.${path.sep}` + path.relative(vscode.workspace.rootPath, currentPythonPath);
225+
}
223226
const quickPickOptions: vscode.QuickPickOptions = {
224227
matchOnDetail: true,
225228
matchOnDescription: false,
226229
placeHolder: `current: ${currentPythonPath}`
227230
};
228231

229232
suggestPythonPaths().then(suggestions => {
233+
suggestions = suggestions.sort((a, b) => a.path > b.path ? 1 : -1);
230234
vscode.window.showQuickPick(suggestions, quickPickOptions).then(
231235
value => {
232236
if (value !== undefined) {

0 commit comments

Comments
 (0)