Skip to content
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.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very large set of details in terminal suggestions for Where-object #241975

Open
mjbvz opened this issue Feb 25, 2025 · 11 comments
Open

Very large set of details in terminal suggestions for Where-object #241975

mjbvz opened this issue Feb 25, 2025 · 11 comments
Assignees
Labels
feature-request Request for new features or functionality terminal-suggest
Milestone

Comments

@mjbvz
Copy link
Collaborator

mjbvz commented Feb 25, 2025

Testing #241771

  1. Trigger terminal suggestions for where-object in powershell

Bug
There's a overwhelming list of variations:

Image
@Tyriar
Copy link
Member

Tyriar commented Feb 26, 2025

This also happens in the pwsh extension as it's the help provided for that:

Image

Closing as out of scope for us, but FYI @andyleejordan in case you have not considered this experience.

@Tyriar Tyriar closed this as completed Feb 26, 2025
@Tyriar Tyriar added the *out-of-scope Posted issue is not in scope of VS Code label Feb 26, 2025
@andyleejordan
Copy link
Member

That's indeed all the available variations of that cmdlet, and how its help is currently written in PowerShell: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/where-object?view=powershell-7.5

@sdwheeler looks like in https://github.com/PowerShell/PowerShell/blob/f467823d5d1495c30cd1e29c5bb2975f429cb9bd/src/System.Management.Automation/engine/InternalCommands.cs#L1280C20-L1280C67 the help included is literally generated from that help document...can we improve it?

@sdwheeler
Copy link

sdwheeler commented Feb 26, 2025

@andyleejordan Nothing to fix here. Where-Object has 32 parameter sets (the maximum allowed). That's the way it's designed.

@andyleejordan
Copy link
Member

@sdwheeler but could the documentation be written more like:

Where-Object
     [-InputObject <PSObject>]
     [-Property] <String>
     [[-Value] <Object>]
     -Match | -CEQ | -NE ...
     [<CommonParameters>]

for all the parameter sets where only one parameter is varying. This is how most man pages are written when other values are shared.

@sdwheeler
Copy link

@andyleejordan Short answer is NO. That's not how the tools work and that's not how PowerShell works. Each parameter set is a unique thing with a unique name. With the new version of PlatyPS that Jim created, your proposed format would not work.

@Tyriar
Copy link
Member

Tyriar commented Feb 27, 2025

@sdwheeler fwiw as someone not very deep in the pwsh ecosystem I agree with the OP that this is pretty overwhelming. Plus it means that when we add detailed help underneath it would almost certainly be scrolled off screen unless we limit these up to 32 entries by say only showing the first 3 and truncating with an ellipsis. Alternatively, we could maybe do the consolidation on our end if we notice the output of Get-Command is repetitious.

This is an early version of what intellisense looks like for a zsh builtin that we pull from the man page:

Image

@sdwheeler
Copy link

We can't change how the help is written. There are too many details and dependencies to explain here.

The problem isn't just that a command can have 32 parameter sets. We also have commands that have LOTS of parameters. Invoke-RestMethod has 4 parameter sets with 54-56 parameters each. How should that be rendered by IntelliSense?

@Tyriar
Copy link
Member

Tyriar commented Feb 27, 2025

@sdwheeler makes sense, thanks. I'm thinking we'll just heavily truncate them when looking at the command, as that information will eventually be surfaced in intellisense for the args and parameter hints if we choose to do that in the terminal.

@Tyriar Tyriar reopened this Feb 27, 2025
@Tyriar Tyriar added feature-request Request for new features or functionality terminal-suggest and removed *out-of-scope Posted issue is not in scope of VS Code labels Feb 27, 2025
@Tyriar Tyriar added this to the March 2025 milestone Feb 27, 2025
@sdwheeler
Copy link

I think it would be useful to wrap the text in the IntelliSense window so that you can see the full syntax of a parameter set.

@Tyriar
Copy link
Member

Tyriar commented Feb 27, 2025

@sdwheeler I agree 👍, we'll probably try align that part with how TypeScript presents it:

Image

@andyleejordan
Copy link
Member

@Tyriar let me know how you end up truncating and displaying it and we can do the same over in the extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality terminal-suggest
Projects
None yet
Development

No branches or pull requests

5 participants