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

Syntax Highlighting doesn't use preinstalled ansible collections

Open max06 opened this issue 1 year ago • 3 comments

Summary

Syntax highlighting and auto-completion is missing for preinstalled ansible collections.

From ansible-config:

COLLECTIONS_ON_ANSIBLE_VERSION_MISMATCH(default) = warning
COLLECTIONS_PATHS(default) = ['/home/vscode/.ansible/collections', '/usr/share/ansible/collections']
COLLECTIONS_SCAN_SYS_PATH(default) = True

From ansible-galaxy collection list:

# /home/vscode/.local/lib/python3.11/site-packages/ansible_collections
Collection                    Version
----------------------------- -------
amazon.aws                    6.1.0  
ansible.netcommon             5.1.1  
ansible.posix                 1.5.4  
...
community.dns                 2.5.6  
community.docker              3.4.8  
community.fortios             1.0.0  
...

My playbook uses the community.docker-collection. The playbook works as expected.

There's no syntax highlighting or auto-completion for collection-content.

Extension version

v2.6.92

VS Code version

1.81.0-insider

Ansible Version

ansible [core 2.15.1]
  config file = /workspaces/project/ansible/ansible.cfg
  configured module search path = ['/home/vscode/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/vscode/.local/lib/python3.11/site-packages/ansible
  ansible collection location = /home/vscode/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/vscode/.local/bin/ansible
  python version = 3.11.4 (main, Jul  4 2023, 05:43:24) [GCC 10.2.1 20210110] (/usr/local/bin/python)
  jinja version = 3.1.2
  libyaml = True

OS / Environment

Debian 11 Container running on Ubuntu 22.04 Remote from Win11 No virtualenv used.

Requirements.txt lists ansible and ansible-lint without version pin.

Relevant log output

No response

max06 avatar Aug 07 '23 14:08 max06

@max06, it seems like your vscode is not open in the correct / desired environment. Try selecting the appropriate python interpreter from the settings.

priyamsahoo avatar Aug 15 '23 03:08 priyamsahoo

This is running in a devcontainer. There is no reason to make use of virtualenv or similar.

max06 avatar Aug 15 '23 11:08 max06

This is also an issue on the neovim side of things. Seems to be an als issue

thelooter avatar Apr 28 '24 23:04 thelooter