vscode-powershell icon indicating copy to clipboard operation
vscode-powershell copied to clipboard

Use the progress indicator when IntelliSense is running

Open MartinGC94 opened this issue 1 year ago • 8 comments

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 avatar Aug 03 '24 20:08 MartinGC94

@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?

JustinGrote avatar Aug 05 '24 16:08 JustinGrote

In the bottom right corner next to the the PowerShell version: image it only shows up while code is running. Ideally there would also be status text like in ISE and Visual Studio: image though I don't know if VS code supports that.

MartinGC94 avatar Aug 05 '24 16:08 MartinGC94

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

JustinGrote avatar Aug 05 '24 17:08 JustinGrote

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.

andyleejordan avatar Sep 03 '24 21:09 andyleejordan

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?

MartinGC94 avatar Sep 04 '24 13:09 MartinGC94

Might need to debounce it to 500ms or something so it doesn't tweak out on every completion call

JustinGrote avatar Sep 04 '24 15:09 JustinGrote

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

ArieHein avatar Oct 08 '24 12:10 ArieHein

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

JustinGrote avatar Jun 30 '25 15:06 JustinGrote