microsoft / inshellisense

IDE style command line auto complete
MIT License
8.23k stars 180 forks source link

Ctrl+a did not activate the prompt function, but only selected the command in PowerShell #72

Closed wsurer closed 7 months ago

wsurer commented 7 months ago

Ctrl+a did not activate the prompt function, but only selected the command in PowerShell

To Reproduce Steps to reproduce the behavior:

  1. execute is bind
  2. select powershell and press 'enter'
  3. type git and press Ctrl+a
  4. did not activate the prompt function, but only selected the command git

Expected behavior active the prompt function for command git

Environment

Additional context it worked normally via executing is and entering the session. image

Muffeter commented 7 months ago

Hello wsurer, check your .ps1 config (probably in C:\Users\<username>\Documents\WindowsPowerShell\), does the line if(Test-Path 'C:\Users\<username>\.inshellisense\key-bindings-powershell.ps1' -PathType Leaf){. C:\Users\<username>\.inshellisense\key-bindings-powershell.ps1} exist in the config? If not you can add the code manually.

It maybe something wrong happened during binding. In my computer it works well. If this doesn't work, please tell me :)

oaustegard commented 7 months ago

Same net effect -- When run from a native powershell command, Ctrl+A merely selects the current command, if run from inside inshellisense it simply outputs the letter a

I can confirm the ps1 config file contains the above line and pointing to an existing key-binding-powershell.ps1

Windows 10 Powershell 7.3.8

SY-LG commented 7 months ago

Same at first. I use Windows 10 with Windows Terminal version 1.18.3181.0 and PowerShell 5.1.19041.3636. Here's how I resolved it:

  1. locate oh-my-posh activate command within the ps1 configuration file: oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\capr4n.omp.json" | Invoke-Expression
  2. move it to a position after the inshellisense binding command.

After doing this, the ctrl+a shortcut started working smoothly for me.

I'm not an expert on this, but I suspect that oh-my-posh somehow alters the environment. But looking at @wsurer's screenshot, it doesn't seem like he's using oh-my-posh. Therefore, it might be worth checking for other suspicious commands that could be causing this issue.

cpendery commented 7 months ago

Closing as this was fixed since we no longer depend on key bindings in 0.0.1-rc.5