Improve path completion - #19489
Conversation
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
…letionCompleters.cs Co-authored-by: Steve Lee <slee@microsoft.com>
Co-authored-by: Paul Higinbotham <paulhi@microsoft.com>
Paul Higinbotham (PaulHigin)
left a comment
There was a problem hiding this comment.
LGTM
Co-authored-by: Ilya <darpa@yandex.ru>
…/PowerShell into ImprovePathCompletion
| return sb.ToString(); | ||
| } | ||
|
|
||
| private static void EscapeCharIfNeeded( |
There was a problem hiding this comment.
Not for the PR. Maybe useful .Net implementation pattern https://source.dot.net/#System.Text.RegularExpressions/System/Text/RegularExpressions/RegexParser.cs,151
|
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) |
|
MartinGC94 Thanks for your contribution! |
|
🎉 Handy links: |
This is an unfortunate change. It's broken me a lot because those tildes not being replaced means that applications no longer understand paths with it in it. I got a suggestion to use Is there a way for me to turn this back on? I'm getting super tired of having to retype (If not, I may have to roll back to 7.3.9 indefinitely to preserve my sanity) |
|
Brad Wilson (@bradwilson) Please open new issue to discuss your scenario(s). |
* Improve path completion * Update src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs Co-authored-by: Steve Lee <slee@microsoft.com> * Address initial feedback from Steve and Paul * Apply suggestions from code review Co-authored-by: Paul Higinbotham <paulhi@microsoft.com> * Apply suggestions from code review Co-authored-by: Ilya <darpa@yandex.ru> * Apply suggestions from iSazonov. * Add missing period to comment. * Add comment explaining limitations of current approach. * Correct some escaping issues and add tests --------- Co-authored-by: Steve Lee <slee@microsoft.com> Co-authored-by: Paul Higinbotham <paulhi@microsoft.com> Co-authored-by: Ilya <darpa@yandex.ru>
PR Summary
Refactor of the file path completion code to make it faster and prepare it for some future improvements I have planned (Not replacing variables in input text, user options for controlling sorting behavior and more).
Speed improvements for relative paths are pretty big:
old: 1.99 seconds
new: 199 ms
Similar improvements are seen in other providers:
Old: 1.60 seconds
new: 139 ms
Also stopped it from replacing
~when referring to home so this:~\Downloads<Tab>no longer turns into:C:\Users\Martin\Downloads\PR Context
Fixes #4797
Contributes to: #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).