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 replaces tilde with full path #20033
Comments
This seems to be a damned if they do and damned if they don't thing. There is another recent issue complaining that external windows exes don't understand ~ in a path. Tab expanding ~ helps to ensure a working path gets sent to things but it annoyed me until I grew used to it. There's probably a wider issue about making ~ work everywhere so that it can happily stay unexpanded by tab |
As noted, with In general, however, I agree that the behavior is unhelpful:
Note that the problem is more general, in that it also affects (environment) variable-based paths; e.g., on Windows: # Pressing TAB at the end of this line expands to a literal, user-specific path; e.g.
# 'C:\Users\jdoe\AppData\Roaming\Microsoft\'
Get-ChildItem $env:APPDATA\Mi |
For the external programs issue, I would expect PowerShell should expand ~ from a PSPath (Temp: / ~) to a provider path (C:\temp) when calling external programs since they don't know what a PSPath is or may not have a concept of This issue is specifically just for tab completion and command history so that what the user typed in is preserved. In my use case it creates a long command with the full path when I'm looking back and just need the relative path from What prompted me originally to log this was when my custom PSDrive |
Strange, you say this is happening in preview 4 but this was actually fixed in the preview 4 release by this PR: #19489 Have you tried loading PS without a custom profile? |
@MartinGC94 you're right, I must have accidently ran pwsh stable when the test with no profile. I can't reproduce on 7.4-preview 4. I can still reproduce the example using environment variables though. Did you fix that as well in your PR? |
@MartinGC94, that's great news, but I can confirm @ThomasNieto's finding that environment variables are still converted to literal paths. Looking at your PR, I see that the issue at hand has a duplicate dating back to 2017: Once the environment-variable issue is also handled, both this and the aforementioned issue should be closed. |
Great, I was afraid there was some weird edge case I had missed. As for the variable replacement, I have some WIP code locally to fix that, I've just been too lazy to finish it. Expect to see a PR for that in the near future. |
Closing as a duplicate of #5350. |
Prerequisites
Steps to reproduce
If you type
~\
thenTab
the home directory symbol will be converted into the full provider path instead of retaining the~
.Expected behavior
# ~ is retained
Actual behavior
# Provider path is used
Error details
N/A
Environment data
Visuals
No response
The text was updated successfully, but these errors were encountered: