Skip to content
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

No space added after auto-completion when using posh-git #964

Open
penguineer opened this issue Nov 14, 2023 · 0 comments
Open

No space added after auto-completion when using posh-git #964

penguineer opened this issue Nov 14, 2023 · 0 comments

Comments

@penguineer
Copy link

System Details

  • posh-git version/path: 1.1.0 ~\Documents\WindowsPowerShell\Modules\posh-git\1.1.0
  • PowerShell version: 5.1.22621.2428
  • git version 2.42.0.windows.2
  • OS: Microsoft Windows NT 10.0.22631.0

Issue Description

I've noticed that a space is not being added after auto-completion. This behavior is different from the default PowerShell behavior and bash behavior, where a space is typically added after auto-completion and is causing some inconvenience as I have to manually add a space.

Here's the configuration I'm using:

Import-Module posh-git

Register-ArgumentCompleter -Native -CommandName az -ScriptBlock {
    param($commandName, $wordToComplete, $cursorPosition)
    $completion_file = New-TemporaryFile
    $env:ARGCOMPLETE_USE_TEMPFILES = 1
    $env:_ARGCOMPLETE_STDOUT_FILENAME = $completion_file
    $env:COMP_LINE = $wordToComplete
    $env:COMP_POINT = $cursorPosition
    $env:_ARGCOMPLETE = 1
    $env:_ARGCOMPLETE_SUPPRESS_SPACE = 0
    $env:_ARGCOMPLETE_IFS = "`n"
    $env:_ARGCOMPLETE_SHELL = 'powershell'
    az 2>&1 | Out-Null
    Get-Content $completion_file | Sort-Object | ForEach-Object {
        [System.Management.Automation.CompletionResult]::new($_, $_, "ParameterValue", $_)
    }
    Remove-Item $completion_file, Env:\_ARGCOMPLETE_STDOUT_FILENAME, Env:\ARGCOMPLETE_USE_TEMPFILES, Env:\COMP_LINE, Env:\COMP_POINT, Env:\_ARGCOMPLETE, Env:\_ARGCOMPLETE_SUPPRESS_SPACE, Env:\_ARGCOMPLETE_IFS, Env:\_ARGCOMPLETE_SHELL
}

Set-PSReadlineKeyHandler -Key Tab -Function Complete

Write-Host "Profile reloaded at $(Get-Date)"

I've tried disabling everything except the posh-git module and resetting my PowerShell settings to their defaults, but the issue persists. I'm not sure if this is a bug in posh-git or if there's a conflict with my configuration.

Any help would be appreciated. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant