vscode-ansible icon indicating copy to clipboard operation
vscode-ansible copied to clipboard

Can't accept inline suggestions

Open jonkyops opened this issue 1 year ago • 8 comments

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

jonkyops avatar Oct 26 '23 19:10 jonkyops

same issue also on a bare metal Ubuntu 22.04 installation

shaneholloman avatar Oct 29 '23 20:10 shaneholloman

same issue on macOS

LarsParTec avatar Nov 07 '23 13:11 LarsParTec

I'm unable to use github copilot, or any tab completions when edting ansible files

jeefberkey avatar Nov 10 '23 19:11 jeefberkey

@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 avatar Nov 17 '23 05:11 hackatoo

@hackatoo Great. Simply disabling/enabling the redhat.ansible extension resolves the issue. Thanks.

LarsParTec avatar Dec 06 '23 08:12 LarsParTec

I got the exact same issue in the specified environment, please provide user an option to disable lightspeed completely.

itsuki-hayashi avatar Dec 25 '23 11:12 itsuki-hayashi

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'"
    },

jonkyops avatar Dec 27 '23 19:12 jonkyops

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.

image

MallocArray avatar Feb 12 '24 22:02 MallocArray