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

Throws error when creating a new file #26

Closed twouters closed 2 years ago

twouters commented 2 years ago

If you open a non-existing file (e.g. a new playbook or role tasks file) the plugin throws an error because it tries to run the ansible-lint command on the filename, which doesn't exist yet:

[coc.nvim] Command failed: ansible-lint  --offline --nocolor -f codeclimate "path/to/file.yml"
yaegassy commented 2 years ago

What are the steps to reproduce this? I cannot reproduce this issue in my environment

twouters commented 2 years ago

Triggers in Arch Linux with:

$ mkdir -p /tmp/coc-ansible-26/tasks
$ vim /tmp/coc-ansible-26/tasks/main.yml

I'll try to reproduce in a clean env

yaegassy commented 2 years ago

All I have been able to confirm is that I get this diagnostics message. Is this the problem?

load-failure[filenotfounderror]
Description: [Errno 2] No such file or directory: '/private/tmp/coc-ansible-26/tasks/main.yml' (Ansible)
coc-ansible-issue-26-1

This is a behavior on the language server side and may not be adjustable on the coc-extension (coc-ansible) side.

twouters commented 2 years ago

Ok, do you think I'll have to report it there then?

twouters commented 2 years ago

Just for completeness, repro steps in a clean docker:

$ docker pull archlinux/archlinux
$ docker run -ti archlinux/archlinux:latest /bin/bash
# pacman -Syu
# pacman -S vim ansible-lint python-black nodejs git npm
# curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# cat <<EOF > ~/.vimrc
call plug#begin()
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'pearofducks/ansible-vim', { 'do': './UltiSnips/generate.sh --style dictionary' }
call plug#end()
let g:coc_filetype_map = {'yaml.ansible': 'ansible',}
EOF
# vim
:PlugInstall
:q!
# vim
:CocInstall @yaegassy/coc-ansible
:q!
# mkdir -p /tmp/coc-ansible-26/tasks
# vim /tmp/coc-ansible-26/tasks/main.yml
:messages
yaegassy commented 2 years ago

Is this the same as mine that you are having problems with? Are you perhaps experiencing different errors, etc.? https://github.com/yaegassy/coc-ansible/issues/26#issuecomment-1236721575

I don't see this as a particularly big problem, but if you do, please file an issue report with the language server itself.

twouters commented 2 years ago

It's the same error, vim just shows different output depending on where it's shown. e.g. if you wait until the ansible lint progress bar stops and press down and up you'll see:

image

It's not a big problem, just a minor annoyance.

yaegassy commented 2 years ago

Hmmm. I tried it in Vim and it behaves the same as Neovim. I can't reproduce your problem. (Never mind the command vimc)

https://user-images.githubusercontent.com/188642/188423297-abb71840-6d01-4d0c-bdd2-fe25526932f2.mp4

yaegassy commented 2 years ago

Ah, I tried increasing the version of ansible-lint and was able to reproduce the problem. Yes, this does feel like noise...

coc-ansible-issue-26-3
yaegassy commented 2 years ago

It seems to be caused by a change in command behavior since v6.5.0 of ansible-lint.

yaegassy commented 2 years ago

@twouters Please issue report to ansible-language-server or ansible-lint. 🙇

twouters commented 2 years ago

Reported at ansible-lint :point_up: While typing the report I figured this is more likely to be fixed in ansible-language-server but we'll see.