-
Notifications
You must be signed in to change notification settings - Fork 1.6k
1228 multiroot interpreter ui changes #1345
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 8 commits into
1228MultiRootMaster
from
1228MultirootInterpreterUIChanges
Oct 30, 2017
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
482d4be
fixes to unit tests and forgotten multiroot
DonJayamanne 62683ff
globally retry all tests 3 times
DonJayamanne 75570ee
refactor changing interpreters
DonJayamanne e3374fe
added tests
DonJayamanne 7498536
fixed linter
DonJayamanne 7debbcf
removed redundant files
DonJayamanne 643d24b
removed unwanted grep
DonJayamanne 581be24
remove blank line
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { commands } from 'vscode'; | ||
|
|
||
| export class ContextKey { | ||
| private lastValue: boolean; | ||
|
|
||
| constructor(private name: string) { } | ||
|
|
||
| public async set(value: boolean): Promise<void> { | ||
| if (this.lastValue === value) { | ||
| return; | ||
| } | ||
| this.lastValue = value; | ||
| await commands.executeCommand('setContext', this.name, this.lastValue); | ||
| } | ||
| } | ||
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
41 changes: 41 additions & 0 deletions
41
src/client/interpreter/configuration/pythonPathUpdaterService.ts
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,41 @@ | ||
| import * as path from 'path'; | ||
| import { ConfigurationTarget, Uri, window } from 'vscode'; | ||
| import { WorkspacePythonPath } from '../contracts'; | ||
| import { IPythonPathUpdaterService, IPythonPathUpdaterServiceFactory } from './types'; | ||
|
|
||
| export class PythonPathUpdaterService { | ||
| constructor(private pythonPathSettingsUpdaterFactory: IPythonPathUpdaterServiceFactory) { } | ||
| public async updatePythonPath(pythonPath: string, configTarget: ConfigurationTarget, wkspace?: Uri): Promise<void> { | ||
| const pythonPathUpdater = this.getPythonUpdaterService(configTarget, wkspace); | ||
|
|
||
| try { | ||
| await pythonPathUpdater.updatePythonPath(path.normalize(pythonPath)); | ||
| } catch (reason) { | ||
| // tslint:disable-next-line:no-unsafe-any prefer-type-cast | ||
| const message = reason && typeof reason.message === 'string' ? reason.message as string : ''; | ||
| window.showErrorMessage(`Failed to set 'pythonPath'. Error: ${message}`); | ||
| console.error(reason); | ||
| } | ||
| } | ||
| private getPythonUpdaterService(configTarget: ConfigurationTarget, wkspace?: Uri) { | ||
| switch (configTarget) { | ||
| case ConfigurationTarget.Global: { | ||
| return this.pythonPathSettingsUpdaterFactory.getGlobalPythonPathConfigurationService(); | ||
| } | ||
| case ConfigurationTarget.Workspace: { | ||
| if (!wkspace) { | ||
| throw new Error('Workspace Uri not defined'); | ||
| } | ||
| // tslint:disable-next-line:no-non-null-assertion | ||
| return this.pythonPathSettingsUpdaterFactory.getWorkspacePythonPathConfigurationService(wkspace!); | ||
| } | ||
| default: { | ||
| if (!wkspace) { | ||
| throw new Error('Workspace Uri not defined'); | ||
| } | ||
| // tslint:disable-next-line:no-non-null-assertion | ||
| return this.pythonPathSettingsUpdaterFactory.getWorkspaceFolderPythonPathConfigurationService(wkspace!); | ||
| } | ||
| } | ||
| } | ||
| } |
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.
Is
setContextan Electron/Chrome thing?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.
vscode thingy