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

Warnings are displayed as errors #27

Closed medanthelinium closed 1 year ago

medanthelinium commented 1 year ago

The errors placed in the warn_list of .ansible-lint are still shown as errors in neovim. The .ansible-lint file is being processed correctly, because when I move those errors to skip_list, ansible-lint ignores them, which is correct.

Versions

coc-ansible: 0.12.2 ansible-language-server: 0.10.1 ansible-lint: 6.6.0 ansible: 2.13.4

.ansible-lint config

skip_list:
  - 'risky-shell-pipe'
  - 'role-name'

warn_list:  
  - package-latest  
  - unnamed-task
  - no-handler
  - fqcn-builtins
yaegassy commented 1 year ago

Diagnostic messages are sent from the language server. If you have any requests for behavior, please submit a feature request to ansible-language-server itself.

yaegassy commented 1 year ago

The following is the diagnostics message returned from ansible-language-server.

[Trace - 5:30:43 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/yaegassy/_Dev/vim/check-coc-extension/ansible-check/roles/ntp/tasks/main.yml",
    "diagnostics": [
        {
            "message": "fqcn-builtins\nDescription: Use FQCN for builtin actions.",
            "range": {
                "start": {
                    "line": 2,
                    "character": 0
                },
                "end": {
                    "line": 2,
                    "character": 2147483647
                }
            },
            "severity": 1,
            "source": "Ansible"
        },
        // ...snip
    ]
}

There is a section called severity.

Changing this value to 2 will cause language clients such as coc.nvim to treat it as a warning messeage.

Below are the specifications for LSP.

I think it would be a good idea to make a request to the language server that messages that match the warn_list: in .ansible-lint be changed to 2.

medanthelinium commented 1 year ago

Seems like this is already happening: https://github.com/ansible/ansible-language-server/blob/1eac729b2cdb19dfa694c4b44f3293d20a16b258/src/services/ansibleLint.ts#L214

yaegassy commented 1 year ago

Now check the behavior in vscode-ansible as well, the developers of ansible-language-server have verified it in vscode. Try it and see if it behaves as you expect. Or it may be a bug in the language server.

In my environment, vscode-ansible outputs the same diagnostics message.

coc-ansible-issue-27-1
medanthelinium commented 1 year ago

Yep, same here. Thank you, I will report the bug