forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Refactor parsing of environment variables #466
Merged
Merged
Changes from all commits
Commits
Show all changes
77 commits
Select commit
Hold shift + click to select a range
ecc1ca9
Fix Microsoft/vscode#37627 (#1368)
octref 7c5778c
Version 0.7.0 of extension (#1381)
DonJayamanne 9d1bf82
Update README.md
DonJayamanne ffba179
Update README.md
DonJayamanne 905c713
sync fork with upstream
DonJayamanne acc2109
fix readme
DonJayamanne d470523
Merge branch 'master' of https://github.com/Microsoft/vscode-python
DonJayamanne d392e8b
merged upstream
DonJayamanne 92f775f
Merge remote-tracking branch 'upstream/master'
DonJayamanne 32a6e53
Merge remote-tracking branch 'upstream/master'
DonJayamanne 4b30f2c
Merge remote-tracking branch 'upstream/master'
DonJayamanne e396752
Merge remote-tracking branch 'upstream/master'
DonJayamanne eff4792
Merge remote-tracking branch 'upstream/master'
DonJayamanne 4553c28
Merge remote-tracking branch 'upstream/master'
DonJayamanne 3c6520a
Merge remote-tracking branch 'upstream/master'
DonJayamanne 966e516
Merge remote-tracking branch 'upstream/master'
DonJayamanne 63d2d65
Merge remote-tracking branch 'upstream/master'
DonJayamanne f6d469e
Merge remote-tracking branch 'upstream/master'
DonJayamanne 029e055
Merge remote-tracking branch 'upstream/master'
DonJayamanne e8c71c0
Merge remote-tracking branch 'upstream/master'
DonJayamanne 51cf9d2
Merge remote-tracking branch 'upstream/master'
DonJayamanne 7aadc43
Merge remote-tracking branch 'upstream/master'
DonJayamanne f0f5c59
Merge remote-tracking branch 'upstream/master'
DonJayamanne b2b9da9
Merge remote-tracking branch 'upstream/master'
DonJayamanne 30a4091
Merge remote-tracking branch 'upstream/master'
DonJayamanne b16d2f9
Merge remote-tracking branch 'upstream/master'
DonJayamanne c8db345
Merge remote-tracking branch 'upstream/master'
DonJayamanne 0df7f16
Merge remote-tracking branch 'upstream/master'
DonJayamanne 3ccc881
Merge remote-tracking branch 'upstream/master'
DonJayamanne bb0709e
Merge remote-tracking branch 'upstream/master'
DonJayamanne 2c19004
Merge remote-tracking branch 'upstream/master'
DonJayamanne 8f224ab
Merge remote-tracking branch 'upstream/master'
DonJayamanne 41b7080
Merge remote-tracking branch 'upstream/master'
DonJayamanne dab38dc
Merge remote-tracking branch 'upstream/master'
DonJayamanne ae22dd4
Merge remote-tracking branch 'upstream/master'
DonJayamanne d2340d2
Merge remote-tracking branch 'upstream/master'
DonJayamanne bcb8879
use new exec engine instead of spawning manually
DonJayamanne c6d6f50
refactor to use new execution framework
DonJayamanne 65a949b
refactor to use new exec framework
DonJayamanne c8559ea
fix linter errors
DonJayamanne 51a2802
refactor
DonJayamanne c778493
disable messages and copy config files
DonJayamanne a34a62c
remove old execution layer
DonJayamanne 9452d0e
misc
DonJayamanne 52bb7ae
Merge remote-tracking branch 'upstream/master'
DonJayamanne 5760886
merged master
DonJayamanne 1714f0c
Merge branch 'D' into FixDebuggerEnvVars
DonJayamanne 1bdc95d
fix tests
DonJayamanne 0313000
fix tests
DonJayamanne e7eb19e
disable message D102
DonJayamanne d09b3ef
fix bug introduced into test
DonJayamanne 0467d4c
fix tests
DonJayamanne ffdfd5d
fixed code review comments
DonJayamanne 59ff402
added tests for env variable parsing
DonJayamanne bab860f
remove metadata
DonJayamanne b6b2531
Merge remote-tracking branch 'upstream/master'
DonJayamanne 2b21cec
merged master
DonJayamanne 56d5c60
Merge branch 'FixDebuggerEnvVars' into EnvVarFixes
DonJayamanne 0ea674b
Merge branch 'RefactorJediAndOthers' into EnvVarFixes
DonJayamanne 09d2372
refactor environment variables parser
DonJayamanne 203e13e
fixed linter error
DonJayamanne 21601f2
Fixed code review comments
DonJayamanne 733f9a1
Merge branch 'RefactorJediAndOthers' into EnvVarFixes
DonJayamanne 24fa57e
added tests for env vars service
DonJayamanne 649b7e7
console could be null
DonJayamanne 8d8d2fc
Merge remote-tracking branch 'upstream/master'
DonJayamanne 6641ec8
merged master
DonJayamanne b65d7c0
merged master
DonJayamanne e6c9472
use new env variables service in jedi service
DonJayamanne 98b6993
add missing service registrations
DonJayamanne 25e4b71
add missing service registration
DonJayamanne 30d0bb5
remove imports of 'reflect-metadata'
DonJayamanne 25d3758
fixed code review comments
DonJayamanne 7a45b2d
removed unused var
DonJayamanne 513901a
Merge branch 'RefactorJediAndOthers' into EnvVarFixes
DonJayamanne 2519217
Merge branch 'master' into EnvVarFixes
DonJayamanne 8788cb6
Merge branch 'master' into EnvVarFixes
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 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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,47 @@ | ||
import * as _ from 'lodash'; | ||
|
||
type AsyncVoidAction = (...params: {}[]) => Promise<void>; | ||
type VoidAction = (...params: {}[]) => void; | ||
|
||
/** | ||
* Debounces a function execution. Function must return either a void or a promise that resolves to a void. | ||
* @export | ||
* @param {number} [wait] Wait time. | ||
* @returns void | ||
*/ | ||
export function debounce(wait?: number) { | ||
// tslint:disable-next-line:no-any no-function-expression | ||
return function (_target: any, _propertyName: string, descriptor: TypedPropertyDescriptor<VoidAction> | TypedPropertyDescriptor<AsyncVoidAction>) { | ||
const originalMethod = descriptor.value!; | ||
// tslint:disable-next-line:no-invalid-this no-any | ||
(descriptor as any).value = _.debounce(function () { return originalMethod.apply(this, arguments); }, wait); | ||
}; | ||
} | ||
|
||
/** | ||
* Swallows exceptions thrown by a function. Function must return either a void or a promise that resolves to a void. | ||
* @export | ||
* @param {string} [scopeName] Scope for the error message to be logged along with the error. | ||
* @returns void | ||
*/ | ||
export function swallowExceptions(scopeName: string) { | ||
// tslint:disable-next-line:no-any no-function-expression | ||
return function (_target: any, propertyName: string, descriptor: TypedPropertyDescriptor<VoidAction> | TypedPropertyDescriptor<AsyncVoidAction>) { | ||
const originalMethod = descriptor.value!; | ||
const errorMessage = `Python Extension (Error in ${scopeName}, method:${propertyName}):`; | ||
// tslint:disable-next-line:no-any no-function-expression | ||
descriptor.value = function (...args: any[]) { | ||
try { | ||
// tslint:disable-next-line:no-invalid-this no-use-before-declare no-unsafe-any | ||
const result = originalMethod.apply(this, args); | ||
|
||
// If method being wrapped returns a promise then wait and swallow errors. | ||
if (result && typeof result.then === 'function' && typeof result.catch === 'function') { | ||
return (result as Promise<void>).catch(error => console.error(errorMessage, error)); | ||
} | ||
} catch (error) { | ||
console.error(errorMessage, error); | ||
} | ||
}; | ||
}; | ||
} |
This file contains 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,10 @@ | ||
import { injectable } from 'inversify'; | ||
import { ICurrentProcess } from '../types'; | ||
import { EnvironmentVariables } from '../variables/types'; | ||
|
||
@injectable() | ||
export class CurrentProcess implements ICurrentProcess { | ||
public get env(): EnvironmentVariables { | ||
return process.env; | ||
} | ||
} |
This file contains 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 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 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 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 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 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 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.
What is "debouncing"?