1
1
import { inject , injectable } from 'inversify' ;
2
- import { ConfigurationTarget , Disposable , QuickPickItem , QuickPickOptions , Uri } from 'vscode' ;
2
+ import { ConfigurationTarget , Disposable , QuickPickOptions , Uri } from 'vscode' ;
3
3
import { IApplicationShell , ICommandManager , IDocumentManager , IWorkspaceService } from '../../common/application/types' ;
4
4
import { Commands } from '../../common/constants' ;
5
- import { IConfigurationService , IPathUtils } from '../../common/types' ;
5
+ import { IConfigurationService , IPathUtils , Resource } from '../../common/types' ;
6
6
import { IInterpreterService , IShebangCodeLensProvider , PythonInterpreter , WorkspacePythonPath } from '../contracts' ;
7
- import { IInterpreterComparer , IInterpreterSelector , IPythonPathUpdaterServiceManager } from './types' ;
8
-
9
- export interface IInterpreterQuickPickItem extends QuickPickItem {
10
- path : string ;
11
- }
7
+ import { IInterpreterComparer , IInterpreterQuickPickItem , IInterpreterSelector , IPythonPathUpdaterServiceManager } from './types' ;
12
8
13
9
@injectable ( )
14
10
export class InterpreterSelector implements IInterpreterSelector {
@@ -34,10 +30,10 @@ export class InterpreterSelector implements IInterpreterSelector {
34
30
this . disposables . push ( this . commandManager . registerCommand ( Commands . Set_ShebangInterpreter , this . setShebangInterpreter . bind ( this ) ) ) ;
35
31
}
36
32
37
- public async getSuggestions ( resourceUri ?: Uri ) {
38
- const interpreters = await this . interpreterManager . getInterpreters ( resourceUri ) ;
33
+ public async getSuggestions ( resource : Resource ) {
34
+ const interpreters = await this . interpreterManager . getInterpreters ( resource ) ;
39
35
interpreters . sort ( this . interpreterComparer . compare . bind ( this . interpreterComparer ) ) ;
40
- return Promise . all ( interpreters . map ( item => this . suggestionToQuickPickItem ( item , resourceUri ) ) ) ;
36
+ return Promise . all ( interpreters . map ( item => this . suggestionToQuickPickItem ( item , resource ) ) ) ;
41
37
}
42
38
protected async suggestionToQuickPickItem ( suggestion : PythonInterpreter , workspaceUri ?: Uri ) : Promise < IInterpreterQuickPickItem > {
43
39
const detail = this . pathUtils . getDisplayName ( suggestion . path , workspaceUri ? workspaceUri . fsPath : undefined ) ;
0 commit comments