Refactor extension to remove old way of spawning python processes#439
Conversation
Archive of 0.7.0
* 'master' of https://github.com/Microsoft/vscode-python: Fixes #56 list all environments (#219) Fixes #57 Disable activation on debugging (#220) Fixes #26 Do not run linters when linters are disabled (#222)
* upstream/master: Fix typo in README.md (#252) Disable linter without workspaces (#241)
* upstream/master: Fix feedback service (#246) Fix django context initializer (#248) disable generation of tags file upon extension load (#264)
* upstream/master: Resolve pythonPath before comparing it to shebang (#273)
* upstream/master:
Fixes #22 to Detect anaconda from known locations (#221)
Use workspaceFolder token instead of workspaceRoot (#267)
Fix registry lookup response (#224)
Fix issues when running without debugging and debugged code terminates (#249)
* upstream/master: Fix debugging tests (#304)
* upstream/master: Remove jupyter functionality in favor of Jupyter extension (#302) Drop Python 2 URLs (#307)
* upstream/master: Remove setting python.formatting.formatOnSave in favor of the vs code setting (#312)
* upstream/master: Remove setting linting.lintOnTextChange as it was never implemented (#315)
* upstream/master: Fix travis build error (#326)
* upstream/master: add new npm deps with improved gulp for dev (#328)
* upstream/master: Update version of inversify package (#329)
* upstream/master: Document our dev process (#330)
* upstream/master: Document contribution to the code along with coding standards (#321)
* upstream/master: Add Simplified Chinese translation of commands (#240)
* upstream/master: Fix package.json (#347)
* upstream/master: #34, #110 - suppress Intellisense in strings and comments (#339) Re-factor code python execution framework (#345)
* upstream/master: Fix linters to make use of the new python code execution framework (#360) Update the versioning scheme (#356) Make npm happy in regards to line endings (#357)
* upstream/master: Ensure python path is not set if already set in user settings (#369) Use 'an' rather than 'a' before vowel words (#373)
* upstream/master: Use new environment variable parser (#362)
| if (output.stdout.length > 0) { | ||
| // Take the first available version number, see below example. | ||
| // pip 9.0.1 from /Users/donjayamanne/anaconda3/lib/python3.6/site-packages (python 3.6). | ||
| // Take the second part, see below example. |
There was a problem hiding this comment.
What's the second part? And the example is the same, so it reads like you're taking two things from do different formats when it's two things from the same format.
There was a problem hiding this comment.
Old comments, will fix that.
| } else { | ||
| args.push('custom'); | ||
| args.push(this.pythonSettings.jediPath); | ||
| // Use preview version of jedi library. |
There was a problem hiding this comment.
I would drop "library" from the comment.
| } else { | ||
| const data = output.out; | ||
| // Possible there was an exception in parsing the data returned, | ||
| // so append the data then parse it. |
| // Great example of poorly written code (this whole file is a mess). | ||
| // I think this needs to be removed, because this is misspelt, it is argments, 'U' is missing, | ||
| // And that case is handled further down | ||
| // case CommandType.Arguments: { |
There was a problem hiding this comment.
Uh, so I don't know what to do with this comment. 😄 If the code should be ripped out then rip it out and drop the comment. 😉
There was a problem hiding this comment.
Can do, was reluctant to clean up this messy file.
| default: | ||
| break; | ||
| } | ||
| // Check if too many pending requets. |
|
@brettcannon all issues have been addressed. Thanks |
1 similar comment
|
@brettcannon all issues have been addressed. Thanks |
* upstream/master: Refactor formatters to use new execution framework (#426)
brettcannon
left a comment
There was a problem hiding this comment.
Just a warning that my review was slightly rushed.
| // tslint:disable-next-line:no-any | ||
| let responses: any[]; | ||
| try { | ||
| responses = dataStr.split(/\r?\n/g).filter(line => line.length > 0).map(resp => JSON.parse(resp)); |
There was a problem hiding this comment.
Don't forget about that helper on splitting lines. 😉
|
@brettcannon Thats fine, I'll leave the PR open. Lets get it reviewed correctly in the new year. I'll base other PRs off this branch. |
* upstream/master: Release 0.9.1 (#458) Add localization for Japanese (#434) Add Svn to uriSchemesToIgnore (#443)
| return matches[0].trim(); | ||
| } | ||
| } | ||
| throw new Error(`Unable to determine Pip version from output '${output.stdout}'`); |
There was a problem hiding this comment.
Technically pip is always lowercased.
|
|
||
| switch (cmd.command) { | ||
| case CommandType.Completions: | ||
| this.onCompletion(cmd, response); |
There was a problem hiding this comment.
Maybe assign the method to a variable and then call it after the switch to minimize the chance of getting the call order wrong?
| isPython3 = Promise.resolve(version.indexOf('3.') >= 0); | ||
| initializeDI(); | ||
| const version = await ioc.getPythonVersion(rootWorkspaceUri); | ||
| isPython3 = version.indexOf('3.') >= 0; |
There was a problem hiding this comment.
This will break under Python 2.3 or Python 4.3. What you really want to know is whether something is Python 2 or not since Python 4 will be backwards-compatible with Python 3. IOW we want to set things up so that Python 2 is the special-case so when it comes time to drop support we can rip it out easily as well has not have issues when Python 4 is released.
|
@brettcannon all done. |
Fixes #354