Stop replacing variables in path tab completion#21148
Stop replacing variables in path tab completion#21148MartinGC94 wants to merge 2 commits intoPowerShell:masterfrom
Conversation
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
|
The Interactive WG discussed this. We love the change (and I desperately want it) but we think we need to have a larger conversation about configuring completion preferences before we could take this change (and changes like stopping I can't give any sort of timeline on when those conversations will complete (nor when the result of them will be implemented). It's up to you if you'd like to keep this PR open until that time comes or open a new one at that time. |
a year has passed... I boldly dare to ask how are things are going with these conversations :-) ? |
|
After further discussion in the Working Group, our conclusion is that the user experience introduces too many non-optimal or unsupportable scenarios. |
|
It would be nice if some examples of these non-optimal scenarios could be posted. I mean I recognize that it's not perfect, but like I said in the OP, I think the scenarios where it helps are way more common than the scenarios where it doesn't work. And besides, there's nothing stopping us from making it an opt-in feature. In my eyes there is no way to build a perfect solution for string + variable completion. I can only think of 3 approaches: 1: The current one where variables are simply discarded. So we have to be pragmatic here. Is 1 really the best overall approach? I don't think so. 2 would be the easiest way to implement a bug-free version for, but it would obviously come at the cost of current features like automatically adding quotes and expanding wildcards. |
PR Summary
Improves tab completion so variables don't get replaced when tab completing paths, for example:
ls $env:windir\System3<Tab>will tab complete to:ls $env:windir\System32instead ofls C:\Windows\System32.The way it works is that the variables are resolved, and the resulting string is used to find valid path completions, then the variable text is inserted back into the discovered paths. Because of this implementation it's not perfect, you can trick it to insert the variable into the wrong place, for example:
turns into
${Var}:\Windows\System32\config\instead of the expected:C:\Windows\System32\${Var}onfig\in practice it shouldn't be an issue because people usually use variables to define the root of a path, or to define entire path segments with more unique names.
PR Context
Fixes #5350
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).