You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New-EditorFile FileName.ps1 fails with Exception calling "GetEditorContext" with "0" argument(s): "One or more errors occurred. (Exception of type 'OmniSharp.Extensions.JsonRpc.Server.JsonRpcException' was thrown.)"
#3180
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.
PowerShell extension for Azure Data Studio fails when creating a new file.
Azure data studio Version: 1.25.3 (user setup)
Commit: b277eafb8f5328ea26c6edfddd1999292ac27937
Date: 2021-02-09T23:10:35.151Z
VS Code: 1.48.0
Electron: 9.4.3
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Windows_NT x64 10.0.18363
Issue Description
I am experiencing a problem with...
Trying to create a new ps file from within Azure data studio
Exception calling "GetEditorContext" with "0" argument(s): "One or more errors occurred. (Exception of type 'OmniSharp.Extensions.JsonRpc.Server.JsonRpcException' was thrown.)"
Attached Logs
Follow the instructions in the troubleshooting docs
about capturing and sending logs.
The text was updated successfully, but these errors were encountered:
I ran Set-PSBreakpoint -Command New-EditorFile, stepped through the code and investigated the $pseditor object, then couldn't reproduce the error... Now I can't reproduce it at all under either Windows PowerShell or PowerShell 7 🤦♂️
Edit:
Reproduction steps (and a workaround for @AlejoSQL ):
It would seem that there is no Editor Context when there is no editor window open (which thinking about it makes sense). Notice in the gif the error happens, then I open a new Untitled-1 file, and now the command works as expected.
A fix might be to move the context code later in the function after we've created and opened the file. This should guarantee we have a context (although there's notes about a temp session that might preclude it in that scenario)
System Details
System Details Output
Issue Description
I am experiencing a problem with...
Trying to create a new ps file from within Azure data studio
Expected Behaviour
-- Create a file :)
Actual Behaviour
-- Error thrown
.azuredatastudio\extensions\microsoft.powershell-2020.4.0\modules\PowerShellEditorServices\Commands\Public\CmdletInterface.ps1:128:9
$editorContext = $psEditor.GetEditorContext()
Exception calling "GetEditorContext" with "0" argument(s): "One or more errors occurred. (Exception of type 'OmniSharp.Extensions.JsonRpc.Server.JsonRpcException' was thrown.)"
Attached Logs
Follow the instructions in the troubleshooting docs
about capturing and sending logs.
The text was updated successfully, but these errors were encountered: