Skip to content

Commit

Permalink
Merge pull request #770 from dahlbyk/rkeithhill/fix-new-tab-completio…
Browse files Browse the repository at this point in the history
…n-with-aliases

Fix #769 - register aliases with register-argumentcompleter
  • Loading branch information
rkeithhill authored May 30, 2020
2 parents 95d08af + 8a2a453 commit 26acc4b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# posh-git Release History

## 1.0.0 - TBD

### Fixed

- Register-ArgumentCompleter based tab-expansion in beta4 doesn't work with PowerShell aliases to git,tgit,gitk.
([#769](https://github.com/dahlbyk/posh-git/issues/769))
([PR #770](https://github.com/dahlbyk/posh-git/pull/770))

## 1.0.0-beta4 - March 14, 2020

### Added
Expand Down
5 changes: 4 additions & 1 deletion src/GitTabExpansion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,10 @@ function WriteTabExpLog([string] $Message) {
}

if (!$UseLegacyTabExpansion -and ($PSVersionTable.PSVersion.Major -ge 6)) {
Microsoft.PowerShell.Core\Register-ArgumentCompleter -CommandName git,tgit,gitk -Native -ScriptBlock {
$cmdNames = "git","tgit","gitk"
$cmdNames += Get-Alias -Definition $cmdNames -ErrorAction Ignore | ForEach-Object Name

Microsoft.PowerShell.Core\Register-ArgumentCompleter -CommandName $cmdNames -Native -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPosition)

# The PowerShell completion has a habit of stripping the trailing space when completing:
Expand Down

0 comments on commit 26acc4b

Please sign in to comment.