forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Merge release back into main #16763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Merge release back into main #16763
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0862870
Fix 'Cannot read property 'resolveEnv' of undefined' error (#16677)
03df7c2
Cherry pick fixes into release (#16686)
karthiknadig 2e5d9f7
Change version for release (#16722)
karthiknadig 0263703
Ensure we block on autoselection when no interpreter is explictly set…
8253dc8
Update change log for release. (#16731)
karthiknadig ae979b1
Fix autoselection when opening a python file directly (#16733)
0d910c6
Ignore cache when querying for interpreters during auto-selection (#1…
kimadeline 178eaa8
Update debugger via point release (#16746)
karthiknadig d23ed03
Merge release back into main.
karthiknadig fd14226
Clean up
karthiknadig File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| 'use strict'; | ||
|
|
||
| import { inject, injectable } from 'inversify'; | ||
| import { IWorkspaceService } from './application/types'; | ||
| import { DeprecatePythonPath } from './experiments/groups'; | ||
| import { IExperimentService, IInterpreterPathProxyService, IInterpreterPathService, Resource } from './types'; | ||
| import { SystemVariables } from './variables/systemVariables'; | ||
|
|
||
| @injectable() | ||
| export class InterpreterPathProxyService implements IInterpreterPathProxyService { | ||
| constructor( | ||
| @inject(IInterpreterPathService) private readonly interpreterPathService: IInterpreterPathService, | ||
| @inject(IExperimentService) private readonly experiment: IExperimentService, | ||
| @inject(IWorkspaceService) private readonly workspace: IWorkspaceService, | ||
| ) {} | ||
|
|
||
| public get(resource: Resource): string { | ||
| const systemVariables = new SystemVariables( | ||
| undefined, | ||
| this.workspace.getWorkspaceFolder(resource)?.uri.fsPath, | ||
| this.workspace, | ||
| ); | ||
| const pythonSettings = this.workspace.getConfiguration('python', resource); | ||
| return systemVariables.resolveAny( | ||
| this.experiment.inExperimentSync(DeprecatePythonPath.experiment) | ||
| ? this.interpreterPathService.get(resource) | ||
| : pythonSettings.get<string>('pythonPath'), | ||
| )!; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| 'use strict'; | ||
|
|
||
| import { Uri, WorkspaceConfiguration } from 'vscode'; | ||
| import * as TypeMoq from 'typemoq'; | ||
| import { expect } from 'chai'; | ||
| import { InterpreterPathProxyService } from '../../client/common/interpreterPathProxyService'; | ||
| import { IExperimentService, IInterpreterPathProxyService, IInterpreterPathService } from '../../client/common/types'; | ||
| import { IWorkspaceService } from '../../client/common/application/types'; | ||
| import { DeprecatePythonPath } from '../../client/common/experiments/groups'; | ||
|
|
||
| suite('Interpreter Path Proxy Service', async () => { | ||
| let interpreterPathProxyService: IInterpreterPathProxyService; | ||
| let workspaceService: TypeMoq.IMock<IWorkspaceService>; | ||
| let experiments: TypeMoq.IMock<IExperimentService>; | ||
| let interpreterPathService: TypeMoq.IMock<IInterpreterPathService>; | ||
| const resource = Uri.parse('a'); | ||
| const interpreterPath = 'path/to/interpreter'; | ||
| setup(() => { | ||
| workspaceService = TypeMoq.Mock.ofType<IWorkspaceService>(); | ||
| experiments = TypeMoq.Mock.ofType<IExperimentService>(); | ||
| interpreterPathService = TypeMoq.Mock.ofType<IInterpreterPathService>(); | ||
| workspaceService | ||
| .setup((w) => w.getWorkspaceFolder(resource)) | ||
| .returns(() => ({ | ||
| uri: resource, | ||
| name: 'Workspacefolder', | ||
| index: 0, | ||
| })); | ||
| interpreterPathProxyService = new InterpreterPathProxyService( | ||
| interpreterPathService.object, | ||
| experiments.object, | ||
| workspaceService.object, | ||
| ); | ||
| }); | ||
|
|
||
| test('When in experiment, use interpreter path service to get setting value', () => { | ||
| experiments.setup((e) => e.inExperimentSync(DeprecatePythonPath.experiment)).returns(() => true); | ||
| interpreterPathService.setup((i) => i.get(resource)).returns(() => interpreterPath); | ||
| const value = interpreterPathProxyService.get(resource); | ||
| expect(value).to.equal(interpreterPath); | ||
| }); | ||
|
|
||
| test('When not in experiment, use workspace service to get setting value', () => { | ||
| experiments.setup((e) => e.inExperimentSync(DeprecatePythonPath.experiment)).returns(() => false); | ||
| const workspaceConfig = TypeMoq.Mock.ofType<WorkspaceConfiguration>(); | ||
| workspaceService.setup((i) => i.getConfiguration('python', resource)).returns(() => workspaceConfig.object); | ||
| workspaceConfig.setup((w) => w.get('pythonPath')).returns(() => interpreterPath); | ||
| const value = interpreterPathProxyService.get(resource); | ||
| expect(value).to.equal(interpreterPath); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.