vscode-ansible
vscode-ansible copied to clipboard
Can't accept inline suggestions
Summary
TLDR: When I set "ansible.lightspeed.enabled": false
and hit tab to accept an inline suggestion in an ansible file, VSCode gives a warning in the bottom right: command 'ansible.lightspeed.inlineSuggest.accept' not found
instead of accepting the suggestion.
Looks like it might be caused by the extension's keybindings settings not checking if lightspeed is enabled for tab and escape: https://github.com/ansible/vscode-ansible/blob/main/package.json#L493-L515
Extension version
2.8.108
VS Code version
1.79.2
Ansible Version
ansible [core 2.15.4]
config file = None
configured module search path = ['/home/{wsl user}/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /mnt/c/Users/{win user}/dev/keycloak/ansible/.venv/lib/python3.11/site-packages/ansible
ansible collection location = /home/{wsl user}/.ansible/collections:/usr/share/ansible/collections
executable location = /mnt/c/Users/{win user}/dev/keycloak/ansible/.venv/bin/ansible
python version = 3.11.4 (main, Jun 6 2023, 22:16:46) [GCC 11.3.0] (/mnt/c/Users/{win user}/dev/keycloak/ansible/.venv/bin/python3.11)
jinja version = 3.1.2
libyaml = True
OS / Environment
Windows 10, WSL (Ubuntu 22.04.3 LTS), ansible-lint 6.20.3
Relevant log output
No response
same issue also on a bare metal Ubuntu 22.04 installation
same issue on macOS
I'm unable to use github copilot, or any tab completions when edting ansible files
@shaneholloman @LarsParTec @jeefberkey
Got same error while installing Bito Autocomplete.
I diasabled and enabled Ansible Lightspeed again at @ext:redhat.ansible
and then restarted the Visual Studio.
Now everything seems work fine.
@hackatoo Great. Simply disabling/enabling the redhat.ansible
extension resolves the issue. Thanks.
I got the exact same issue in the specified environment, please provide user an option to disable lightspeed completely.
Adding this to my my keybindings.json fixed it for me (Command Palette > Preferences: Open Keyboard Shortcuts (JSON)):
{
"key": "tab",
"command": "-ansible.lightspeed.inlineSuggest.accept",
"when": "inlineSuggestionVisible && editorLangId == 'ansible'"
},
{
"key": "escape",
"command": "-ansible.lightspeed.inlineSuggest.hide",
"when": "inlineSuggestionVisible && editorLangId == 'ansible'"
},
I finally figured this out! I couldn't use CoPilot suggestions due to the same error when pressing Tab.
I fully uninstalled the Ansible extension, restarted VSCode, confirmed CoPilot Tab complete worked, then reinstalled the Ansible extension and it broke again.
Finally, I found that in the Gear icon in VSCode, there is a "Keyboard Shortcuts" option (Ctrl+K Ctrl+S) In here I found the entry that was throwing the error "ansible.lightspeed.inlineSuggest.accept" and it was bound to Tab, just like the auto-complete was. Rather than mess around with any When statements, I just right clicked and "Remove Keybinding" and now I can use Tab to complete CoPilot suggestions.
Since I never had Lightspeed enabled in the settings, I'm surprised this binding was set at all, but with it completely conflicting with a more helpful option, I won't miss it.