-
Notifications
You must be signed in to change notification settings - Fork 1.6k
#1228 multiroot interpreter display #1339
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
DonJayamanne
merged 44 commits into
1228MultiRootMaster
from
1228MultirootInterpreterDisplay
Oct 26, 2017
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
aad5ca0
modifications to fix tests to run under multi root setup
DonJayamanne a819f69
log errors
DonJayamanne 3b48d84
fix return type
DonJayamanne b290a7e
fix linter messages
DonJayamanne 1e979b9
fix linter errors
DonJayamanne 0959155
changes to ensure code is formatted correctly
DonJayamanne 5ad6d1f
fixed comments
DonJayamanne 26241f2
delete unwanted file
DonJayamanne 6f3aba4
hide unwanted folders
DonJayamanne 35a9cbe
fixes to linters to run on multiroot setup
DonJayamanne f5e4006
udpate settings sequentially
DonJayamanne 34aefa2
log the output
DonJayamanne 3c58408
show errors in deleting dir
DonJayamanne 252a52e
removed prospector test, to be completed in #1319
DonJayamanne 6acaa7a
fixes to tests and sorting provider
DonJayamanne d137b75
fixed test for interpreter display
DonJayamanne 65076f8
undo commenting of code
DonJayamanne 630f83a
add new line
DonJayamanne 0dad286
support multi root in interpreter display
DonJayamanne 9a283c7
merged 1228MultiRootMaster
DonJayamanne 9f90a42
fix linter
DonJayamanne 31aa28f
changed package version
DonJayamanne 63180f0
disabled multiroot test
DonJayamanne 7bdc669
backwards compatible change
DonJayamanne 5956a47
fix nose tests
DonJayamanne 7c8049f
revert change
DonJayamanne 0f6b142
enable test but disable it
DonJayamanne 8570b90
multi root support in utils.ts
DonJayamanne 71f3507
fixed #1328
DonJayamanne c339fab
retries for flaky unit tests
DonJayamanne b0d29da
retry beforeEach
DonJayamanne dfc7451
common retry decorator
DonJayamanne a8eda55
enable telemetry for extension loads
DonJayamanne 32b6d85
disable jupyter tests in multiroot tests
DonJayamanne 155e45f
clean up python Path before and after testsclean up python Path befor…
DonJayamanne df14e35
rename test env variable
DonJayamanne 1b58b20
dispose cfg settings
DonJayamanne f9e8915
dispose cfg settings
DonJayamanne 7d4f0f7
update comment
DonJayamanne 4f880a1
clean up
DonJayamanne 000a25a
rearrange to ensurfe launching ext is first debug option
DonJayamanne 665a233
bug fix for display name
DonJayamanne 22cc2e7
resolved code review comment
DonJayamanne 3cbc067
Fixed typp
DonJayamanne 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 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 @@ | ||
| import { Uri, workspace } from 'vscode'; | ||
|
|
||
| type InterpreterCache = { | ||
| pythonInterpreterDirectory?: string; | ||
| pythonInterpreterPath?: string; | ||
| pythonSettingsPath?: string; | ||
| // tslint:disable-next-line:no-any | ||
| customEnvVariables?: any; | ||
| }; | ||
|
|
||
| const cache = new Map<string, InterpreterCache>(); | ||
|
|
||
| // tslint:disable-next-line:no-stateless-class | ||
| export class InterpreterInfoCache { | ||
| // tslint:disable-next-line:function-name | ||
| public static clear(): void { | ||
| cache.clear(); | ||
| } | ||
| // tslint:disable-next-line:function-name | ||
| public static get(resource?: Uri) { | ||
| const cacheKey = InterpreterInfoCache.getCacheKey(resource) || ''; | ||
| return cache.has(cacheKey) ? cache.get(cacheKey) : {}; | ||
| } | ||
| // tslint:disable-next-line:function-name | ||
| public static setPaths(resource?: Uri, pythonSettingsPath?: string, pythonInterpreterPath?: string, pythonInterpreterDirectory?: string) { | ||
| InterpreterInfoCache.setCacheData('pythonInterpreterDirectory', resource, pythonInterpreterDirectory); | ||
| InterpreterInfoCache.setCacheData('pythonInterpreterPath', resource, pythonInterpreterPath); | ||
| InterpreterInfoCache.setCacheData('pythonSettingsPath', resource, pythonSettingsPath); | ||
| } | ||
|
|
||
| // tslint:disable-next-line:no-any function-name | ||
| public static setCustomEnvVariables(resource?: Uri, envVars?: any) { | ||
| // tslint:disable-next-line:no-any | ||
| InterpreterInfoCache.setCacheData('customEnvVariables', resource, envVars); | ||
| } | ||
| // tslint:disable-next-line:no-any function-name | ||
| private static setCacheData(property: keyof InterpreterCache, resource?: Uri, value?: any) { | ||
| const cacheKey = InterpreterInfoCache.getCacheKey(resource) || ''; | ||
| // tslint:disable-next-line:prefer-type-cast | ||
| const data = cache.has(cacheKey) ? cache.get(cacheKey) : {} as InterpreterCache; | ||
| data[property] = value; | ||
| cache.set(cacheKey, data); | ||
| } | ||
| private static getCacheKey(resource?: Uri): string { | ||
| if (!Array.isArray(workspace.workspaceFolders) || workspace.workspaceFolders.length === 0) { | ||
| return ''; | ||
| } | ||
| if (!resource || workspace.workspaceFolders.length === 1) { | ||
| return workspace.workspaceFolders[0].uri.fsPath; | ||
| } | ||
| const folder = workspace.getWorkspaceFolder(resource); | ||
| return folder ? folder.uri.fsPath : ''; | ||
| } | ||
| } | ||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So is this instead of declaring the variable as void?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it's to treat a variable as one that has no type information. (Kind of like removing type hints when a variable has had type hints defined)