Skip to content
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

Fix New-EditorFile with no folder or no files open #906

Conversation

TylerLeonhardt
Copy link
Member

Without this, the file that gets passed in is relative... When it's relative, it hits this piece of code:

https://github.com/PowerShell/vscode-powershell/blob/d02adc54b1f20d2da7cd5efddae3c0a8400ffe2d/src/features/ExtensionCommands.ts#L533-L536

When it does and there is not Folder or File open in the editor, vscode.workspace.rootPath is set to undefined and thus causes something like New-EditorFile -Path ./foo.txt to fail.

With this change, we resolve any filepaths passed in first before sending them to the client.

fixes #905

Copy link
Collaborator

@SeeminglyScience SeeminglyScience left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@TylerLeonhardt TylerLeonhardt merged commit ffd0ef7 into PowerShell:master Apr 9, 2019
@TylerLeonhardt TylerLeonhardt deleted the fix-new-editorfile-with-no-folder-no-files branch April 9, 2019 15:50
rjmholt pushed a commit to rjmholt/PowerShellEditorServices that referenced this pull request Apr 9, 2019
* Fix New-EditorFile with no folder or no files open

* address rob's feedback
rjmholt pushed a commit to rjmholt/PowerShellEditorServices that referenced this pull request Apr 10, 2019
* Fix New-EditorFile with no folder or no files open

* address rob's feedback
rjmholt pushed a commit that referenced this pull request Apr 10, 2019
* Fix New-EditorFile with no folder or no files open

* address rob's feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New-EditorFile error Exception calling "GetEditorContext" with "0" argument(s): "One or more errors occurred."
3 participants