PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items/ms-vscode.PowerShell
MIT License
1.71k stars 491 forks source link

Enable "Trigger Parameter Hints" for available method/constructor overloads #4606

Open JustinGrote opened 1 year ago

JustinGrote commented 1 year ago

Prerequisites

Summary

Today, available method/constructor overloads are shown when you get to the method body or an open parens image

However, if you are already in a closed parens and want to see the available method/constructor overloads, this is not available, you have to delete the closed parens and retype them to get the prompt again.

Proposed Design

The C# extension wires up to Trigger Parameter Hints when in the method/constructor parameter body, we should do the same. image

image

andyleejordan commented 1 year ago

According to @SeeminglyScience we'll need support in PowerShell itself in order to do this.

JustinGrote commented 1 year ago

@SeeminglyScience without looking at the code I assume the API is the same one when you call a constructor without parens: image

If so, can we "fudge" the completion request to PowerShell to just remove the parens to still get the same result from the API and then display it, or is that too magical?

MartinGC94 commented 1 year ago

I made a suggestion to add an API for this: https://github.com/PowerShell/PowerShell/issues/19619 feel free to give me feedback on the idea I have for the implementation.

SeeminglyScience commented 1 year ago

If so, can we "fudge" the completion request to PowerShell to just remove the parens to still get the same result from the API and then display it, or is that too magical?

That'd be a lot more fudging than you're picturing, and we'd still need to actually parse it which would be super finicky.

We'd definitely need something like what @MartinGC94 proposed. I think there's a huge untapped well of potential if we could set up a performant and consistent public API for member/type inference.