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

Tab completion finds inapplicable dynamic parameter names by single-character prefix #11848

Open
mklement0 opened this issue Feb 14, 2020 · 0 comments

Comments

@mklement0
Copy link
Contributor

@mklement0 mklement0 commented Feb 14, 2020

See #11835 for background.

-Raw is a dynamic parameter specific to the PS FileSystem provider.
It should only tab-complete for (implied) paths targeting a file-system location.

Note: If you make a non-file-system location such as env:\ the current location before running the tests, the symptom does not surface.

Steps to reproduce

Push-Location ('/', 'c:\')[$env:OS -eq 'Windows_NT']

# Expanding based on a non-existent drive after typing just "-" 
# doesn't make -Raw appear, as expected.
$script = 'Get-Content -Path nosuch:\test -'
TabExpansion2 -inputScript $script -cursorColumn $script.Length | % {
  $_.CompletionMatches.CompletionText } | Should -Not -Contain '-Raw'

# Typing "-ra" also works as epected. 
$script = 'Get-Content -Path nosuch:\test -ra'
TabExpansion2 -inputScript $script -cursorColumn $script.Length | % {
  $_.CompletionMatches.CompletionText } | Should -Not -Contain '-Raw'

# Typing "-r" - a SINGLE-letter prefix - unexpectedly DOES make -Raw appear.
$script = 'Get-Content -Path nosuch:\test -r'
TabExpansion2 -inputScript $script -cursorColumn $script.Length | %  {
  $_.CompletionMatches.CompletionText } | Should -Not -Contain '-Raw'

Expected behavior

All tests should succeed.

Actual behavior

The last test fails:

Expected '-Raw' to not be found in collection @('-ReadCount', '-Raw'), but it was found.

Environment data

PowerShell Core 7.0.0-rc.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.