vscode-powershell
vscode-powershell copied to clipboard
Use the progress indicator when IntelliSense is running
Prerequisites
- [X] I have written a descriptive issue title.
- [X] I have searched all issues to ensure it has not already been reported.
Summary
IntelliSense can sometimes be slow to show up because it has to import a module but there's no way to know if it's currently running when it gets autotriggered by typing. This means that if the completion request for whatever reason gets cancelled while I expect it to open I will sit there waiting for nothing for a few moments before manually triggering it.
Proposed Design
There is already a progress indicator that shows if a script is running. Just make it run when IntelliSense is running as well.
@MartinGC94 thanks for your submission! (And all of your PowerShell contributions, I'm never going to miss an opportunity to thank you)
Can you let me know which indicator you mean with a screenshot? When I do something like sleep a script I don't see anything in vscode that I can think of, or are you referring to the OSC indicator that shows up in Windows Terminal with write-progress?
In the bottom right corner next to the the PowerShell version:
it only shows up while code is running. Ideally there would also be status text like in ISE and Visual Studio:
though I don't know if VS code supports that.
Ah I see, I have the additional detail normally hidden which is why I didn't see it, it's now hidden by default behind the language ellipsis because that's what the vscode team wants.
We have full control over that dialog so it would be possible to wire in the same handler that we use for pipeline activities to the completion requests as well. I can't remember if that control has the ability to tooltip highlight.
@andyleejordan for additional thoughts/input
That is a great question and I'd have to dig into it. Actually turning the spinner on and off is fairly simple: it's a pair of LSP notifications. But knowing when to do so (especially if we start doing it in more than one place) is a different matter.
Runspaces have 2 events AvailabilityChanged and StateChanged. Maybe you could just subscribe to one of those events and start the spinner whenever it signals that it's busy?
Might need to debounce it to 500ms or something so it doesn't tweak out on every completion call
Maybe a differernt visualization as short actions will barely move the 'wheel'. Maybe a blinking red dot next to the PowerShell language indicator (above N ms) ? not sure VS itself allows it graphically.
Or the entire 'PowerShell' word changes for that duration, similar to how the GH Copliot replaces the icon with a spinner
Per my other thread I think the improvements to make are:
- Spin whenever the runspace is blocked, whether that's triggered by PSES or not (debounce probably necessary)
- Add an optional descriptor on the task pipeline objects so that handlers can "label" what their execution request is, and surface that in the LSP/UI