PowerShellEditorServices
PowerShellEditorServices copied to clipboard
$psEditor.Window.ShowErrorMessage never returns
Steps
- In the integrated console run
$psEditor.Window.ShowErrorMessage('test') - Do not click the X on the notifcation, instead click anywhere in the body and press escape.
Expected
The notification to be dismissed and the prompt to return.
Actual
The notification is dismissed, but the prompt never returns. ShowErrorMessage blocks the pipeline indefinitely.
Notes
The pipeline completes if the X is clicked instead. All that said, I don't think it should ever wait for completion. It feels real bad, especially from editor commands, to require dismissing the notification to free up the pipeline thread.
. All that said, I don't think it should ever wait for completion.
I think that's been the behavior for a while now and I totally agree with you. It should be a notification, not a request expecting a response.
. All that said, I don't think it should ever wait for completion.
I think that's been the behavior for a while now
Yeah I was bypassing it by sending the message directly with the old IMessageSender, since it had a general waitForResponse parameter. New one doesn't have a way to do that afaict though.
https://github.com/PowerShell/PowerShellEditorServices/blob/master/src/PowerShellEditorServices/Services/PowerShellContext/EditorOperationsService.cs#L159-L180
A simple change. Instead of SendRequest it's SendNotification
Then in vscode-powershell change these to NotificationType:
https://github.com/PowerShell/vscode-powershell/blob/master/src/features/ExtensionCommands.ts#L142-L156
And change onRequest to onNotification
https://github.com/PowerShell/vscode-powershell/blob/master/src/features/ExtensionCommands.ts#L253-L267
I think I'm just gonna use window/showMessage directly actually. Still a good change to make though.