Skip to content

Fix tab completion for parameters so that it shows common parameters as available #10850

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

Merged
merged 5 commits into from
Oct 31, 2019

Conversation

SteveL-MSFT
Copy link
Member

@SteveL-MSFT SteveL-MSFT commented Oct 20, 2019

PR Summary

The current code deliberately filtered out common parameters and preferring specific parameters. This resulted in tab completion where you only got results if the text matched a cmdlet parameter even though it would also match a common parameter. Fix is to use the filtering code only if it's not a tab complete situation. The tryExactMatching is only used when the cmdlet is being executed and not when tab complete is being used so we can use that to only exercise the filtering code.

PR Context

Fix #1265

PR Checklist

@iSazonov
Copy link
Collaborator

iSazonov commented Oct 20, 2019

I guess that initial design was to hide common parameters because in cmdlets with many parameters they can annoy. If I remember right there was a suggestion to show common parameters with<Ctrl-Tab> but hide with <Tab>.

@SteveL-MSFT SteveL-MSFT changed the title BUG: Remove code that filtered out common params so they show up with… Remove code that filtered out common params so they show up with… Oct 21, 2019
@SteveL-MSFT SteveL-MSFT changed the title Remove code that filtered out common params so they show up with… WIP: Remove code that filtered out common params so they show up with… Oct 21, 2019
@SteveL-MSFT
Copy link
Member Author

Ok, found an unintended side effect that makes this a breaking change. With the filtering, you could do: gm -i $a as it prefers cmdlet params to common params. With this change, gm -i $a throws that the parameter is ambiguous as it could be -informationaction or -informationvariable. Will need some additional code to handle this case.

reformat Get-Member tests as it had embedded tabs
@SteveL-MSFT SteveL-MSFT changed the title WIP: Remove code that filtered out common params so they show up with… Remove code that filtered out common params so they show up with… Oct 21, 2019
@SteveL-MSFT
Copy link
Member Author

With the new update and simpler fix, this is not a breaking change :)

@SteveL-MSFT SteveL-MSFT changed the title Remove code that filtered out common params so they show up with… Fix code so that tab completion for parameters shows common parameters as available Oct 22, 2019
…r.Tests.ps1

Co-Authored-By: Ilya <darpa@yandex.ru>
@SteveL-MSFT SteveL-MSFT changed the title Fix code so that tab completion for parameters shows common parameters as available Fix tab completion for parameters so that it shows common parameters as available Oct 22, 2019
@SteveL-MSFT
Copy link
Member Author

@PoshChan please retry static

@PoshChan
Copy link
Collaborator

@SteveL-MSFT, successfully started retry of PowerShell-CI-static-analysis

@SteveL-MSFT
Copy link
Member Author

@PoshChan please retry windows

@PoshChan
Copy link
Collaborator

@SteveL-MSFT, successfully started retry of PowerShell-CI-Windows

@SteveL-MSFT
Copy link
Member Author

@PoshChan please retry static

@PoshChan
Copy link
Collaborator

@SteveL-MSFT, successfully started retry of PowerShell-CI-static-analysis

@iSazonov iSazonov added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Oct 31, 2019
@iSazonov iSazonov added this to the 7.0.0-preview.6 milestone Oct 31, 2019
@daxian-dbw daxian-dbw merged commit df81192 into PowerShell:master Oct 31, 2019
@ghost
Copy link

ghost commented Nov 21, 2019

🎉v7.0.0-preview.6 has been released which incorporates this pull request.:tada:

Handy links:

@SteveL-MSFT SteveL-MSFT deleted the tabcomplete-commonparams branch June 6, 2020 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tab completion confusion with common parameters
5 participants