ansible / vscode-ansible

vscode/vscodium extension for providing Ansible auto-completion and integrating quality assurance tools like ansible-lint, ansible syntax check, yamllint, molecule and ansible-test.
https://ansible.readthedocs.io/projects/vscode-ansible/
MIT License
363 stars 92 forks source link

WSL Support missing? #14

Closed tsia closed 3 years ago

tsia commented 3 years ago

Hi,

i hate to be that guy but this extension isn't working for me at all. I have the suspicion that the fact that I'm using WSL isn't helping either. When i'm running vscode inside the WSL environment via the "Remote" feature, nothing happens when i save the file. When i'm running it "normally" on Windows it obviously complains that the path to ansible-lint is invalid because i only installed it inside WSL.

ssbarnea commented 3 years ago

To be honest support for WSL would clearly not come from me, but I would neither fight any pull-request that adds it.

What I can tell you is that my plan is to make it able to reuse already existing toolset container which contains ansible-lint. Still my experience with vscode extension writing is very limited, so help would be more than welcomed.

At its current state it is working in "bring your own ansible-lint" mode, where you are responsible for installing it yourself and either adding it to your PATH or configuring the path to it.

tsia commented 3 years ago

unfortunately i don't know a lot about how vscode works internally. i would have expected vscode to do the WSL magic by itself. especially when it explicitly supports it.

i have installed ansible-lint inside WSL and i also set the path in settings.json:

{
  "ansible.validate.executablePath": "/home/tsia/.local/bin/ansible-lint"
}
# which ansible-lint
/home/tsia/.local/bin/ansible-lint

what i just realized: when i save the playbook on "bare" windows i at least get some feedback that your extension is being executed. When i save in WSL nothing happens at all. Is there a way to see if your extension is triggered at all?

erclu commented 3 years ago

chiming in to tell you that the extension as of today works inside WSL for me; I didn't even need to add the explicit executable path, it was picked up correctly from PATH.

In your case there might be some other reason why it's not working. If you're still interested in this, I'd say it could be something like the fact that you're using some other extension that changes the language mode for ansible files. Currently the extension works only if the configured language for the file is yaml.

Is there a way to see if your extension is triggered at all?

I've fiddled around and i found that you can search for the string "vscode-ansible" inside the output channel Log (Remote Extension host):

image

You can also open the vscode developer tools, go to console and search for this message:

image

tsia commented 3 years ago

thanks for the hints. i'm not sure what went wrong here. on another machine vscode wasn't updating properly so vscode-ansible wasn't updating as well. maybe that was the same on my WSL machine. anyway it's working now as expected.