yaegassy / coc-ansible

ansible-language-server extension for coc.nvim
https://www.npmjs.com/package/@yaegassy/coc-ansible
MIT License
71 stars 3 forks source link

Current master of ansible-langauge-server causes an error in ansible-playbook #8

Closed yaegassy closed 2 years ago

yaegassy commented 2 years ago

I tried ansible-language-server on "master" since there is no new version released on npm yet.

This error occurs in coc-ansible.

roles/common/tasks/main.yml|4 col 3 error| [Ansible] Command failed: ansible-playbook /Users/yaegassy/_Dev/vim/check-coc-extension/ansible-examples/lamp_simple/roles/common/tasks/main.yml --syntax-check [E]

Capture:

coc-ansible-next-rc-issue

If you have created a virtual environment, activated it, and installed ansible (ansible-playbook is included) and ansible-lint on it, it will work.

I don't know if this is a bug in ansible-language-server.

If the situation does not change in the next official release, we will unfortunately remove the "built-in installation feature" of coc-ansible.

yaegassy commented 2 years ago

I got the same error when I installed only ansible in a virtual environment (venv).

I was able to install ansible-lint and it worked fine.

I feel like there is something wrong with ansible-language-server's ansible-lint auto-detection handling...

yaegassy commented 2 years ago

First, the syntax check of ansible-playbook seems to be running. Apparently, from this code, ansible's path setting is very important (full path?).

REF: https://github.com/ansible/ansible-language-server/blob/main/src/services/ansiblePlaybook.ts#L66-L71

// ...snip
    const [command, env] = withInterpreter(
      `${settings.ansible.path}-playbook`,
      `${docPath} --syntax-check`,
      settings.python.interpreterPath,
      settings.python.activationScript
    );
// ...snip

Up to now, we have only had to set the path to the appropriate python interpreter, but from now on, we will also need to set the PATH of the ansible, ansible-lint commands.

yaegassy commented 2 years ago

Check with 0.2.2-beta of @ansible/ansible-language-server.

It worked fine with the built-in installed tools.

yaegassy commented 2 years ago

This seems to be a known bug, so I will close this issue.

https://github.com/yaegassy/coc-ansible/issues/2#issuecomment-946657389