-
-
Notifications
You must be signed in to change notification settings - Fork 809
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
feature/tab-expand-pwsh-alias #779
feature/tab-expand-pwsh-alias #779
Conversation
…d proxy command names to the argument completer.
…or disabling of proxy command expansion.
…y commands when the expansion was disabled.
…s1 file to script scope. Separated the alias tests into their own context.
…tup and teardown sections for tests. Updated the alias to use script scope instead of global scope in the tests.
…sion to pass the new tests.
…ck newlines was accepted.
…ching [^\S\r\n] to indicate non-newline whitespaces. Added a test that covers newlines preceding backtick newlines.
…n PowerTab was loaded.
Right now, there's an issue with how the proxy command expansion works in the PowerShell 6+ tab expansion implementation. Because the registration for the proxy commands needs to happen at module load time, any changes to the
I'm leaning towards the first option, but I realize it isn't very idiomatic for the module to configure settings via a function. Edit: Didn't see that you loaded the |
@dahlbyk Where are we with this? |
…dCommandName property already traverses the alias chain.
@MisinformedDNA I've been using this implementation for about six weeks on Windows with Powershell 7, and I haven't encountered any issues yet. It may fail on some cases I haven't encountered, but it shouldn't be too hard to push fixes in with the tests I added. Still waiting on the review though. |
Since this isn't enabled by default, I think we should add this for v1 and have folks try it out. I'll be adding some review comments here shortly mostly about style nits. After those are addressed, I'll accept this PR. |
…biguate between PowerShell's official Proxy Command system.
…unctionExpansion.Tests.ps1.
…mand* to *ProxyFunction*.
Thanks @rkeithhill for reviewing. 😃 |
@csc027 How can I enable this functionality? |
@MisinformedDNA If you have the version with the change in, you have to import while setting the module arguments. I don't think the PowerShell Gallery version has been updated with these changes yet; so, you'll likely need to import it from your Git repository directly. Either way, the module arguments are: [bool]$ForcePoshGitPrompt,
[bool]$UseLegacyTabExpansion,
[bool]$EnableProxyFunctionExpansion , which can be set via: Import-Module -Name '<path to posh-git.psd1 file>' -ArgumentList @($false, $false, $true) |
Ah... that's what I was missing. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM. Only issue is that I think perhaps the regex should be moved to the GitTabSettings object so that folks have a chance to tweak the regex for their proxy functions.
Oops. This is already merged. Yikes this tab has been hanging around in my browser for a long time. :-) |
See: Issue comment <dahlbyk/posh-git#779 (comment)>
See: Issue comment <dahlbyk/posh-git#779 (comment)>
See: Issue comment <dahlbyk/posh-git#779 (comment)>
See: Issue comment <dahlbyk/posh-git#779 (comment)>
This seems to work on aliases but not on functions. For example:
still have to write |
@SB-USNC The tab completion should work for the function. What doesn't work here is the tab completion for the alias to the function. I use a lot of functions defined like this and with this feature enabled, I get tab completion (and Ctrl+Space) when using function gsw { git switch $args } |
This patch implements what @jkymarsh wanted in #257. I also included changes to handle the newer expansion logic with
Register-ArgumentCompleter
. Many of the basic test cases for the proxy commands have already been implemented, but I think I may be missing some edge cases here. In broader terms, what am I missing in terms of test cases?There is also the issue of the regular expression not not handling all whitespace characters. It currently handles the case of multiline commands. For example:
The original regular expression used the
\s
character class,"(^|[|;])\s*(?<cmd>$(Get-AliasPattern git).* \`$args)\s*($|[|;])"
but incorrectly allowed multiline commands without the backticks.
The regular expression for reference: