iamcco / coc-diagnostic

diagnostic-languageserver extension for coc.nvim
245 stars 22 forks source link

vint not running #62

Closed mosheavni closed 3 years ago

mosheavni commented 3 years ago

Describe the bug It seems that linting for vim with vint is not running, while shellcheck is working great. I made sure vint is installed, and there are diagnostics for vim.

$ vint --enable-neovim .vimrc
.vimrc:1:1: Use scriptencoding when multibyte char exists (see :help :scriptencoding)
.vimrc:10:1: Do not use nocompatible which has unexpected effects (see :help nocompatible)
.vimrc:13:15: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:15:19: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:77:47: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:90:15: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:91:27: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:92:19: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:93:27: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:97:1: autocmd should execute in an augroup or execute with a group (see :help :autocmd)
.vimrc:105:8: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:155:3: autocmd should execute in an augroup or execute with a group (see :help :autocmd)
.vimrc:176:11: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:202:15: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:341:17: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:342:24: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:349:11: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:351:9: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:352:11: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:353:9: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:353:37: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:370:3: autocmd should execute in an augroup or execute with a group (see :help :autocmd)
.vimrc:417:25: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:420:30: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:420:70: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:454:13: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:468:32: Prefer single quoted strings (see Google VimScript Style Guide (Strings))
.vimrc:558:7: Prefer single quoted strings (see Google VimScript Style Guide (Strings))

I added:

  "diagnostic-languageserver.debug": true,
  "diagnostic-languageserver.trace.server": "verbose",

To see the output channel (without them, the channel just does not exist, and it's poorly documented), my .vimrc's diagnostic is empty even though vint does return output.

My coc-settings.json:

{
  "coc.preferences.useQuickfixForLocations": true,
  "tsserver.reportStyleChecksAsWarnings": true,
  "diagnostic.checkCurrentLine": true,
  "diagnostic.errorSign": "✘",
  "diagnostic.hintSign": "",
  "diagnostic.infoSign": "",
  "diagnostic.warningSign": "",
  "diagnostic-languageserver.filetypes": {
    "sh": "shellcheck",
    "vim": "vint"
  },
  "diagnostic-languageserver.formatFiletypes": {
    "terraform": "tffmt",
    "sh": "shfmt"
  },
  "diagnostic-languageserver.debug": true,
  "diagnostic-languageserver.trace.server": "verbose",
  "suggest.timeout": 5000,
  "suggest.enablePreview": true,
  "suggest.triggerAfterInsertEnter": true
}

Expected behavior I'd like to have vim linting with vint.

Desktop (please complete the following information):

Full Log

[Trace - 10:13:48 AM] Sending request 'initialize - (0)'.
Params: {
    "processId": 50164,
    "rootPath": "/Users/moshe.avni/src/dotfiles",
    "rootUri": "file:///Users/moshe.avni/src/dotfiles",
    "capabilities": {
        "workspace": {
            "applyEdit": true,
            "workspaceEdit": {
                "documentChanges": true,
                "resourceOperations": [
                    "create",
                    "rename",
                    "delete"
                ],
                "failureHandling": "textOnlyTransactional"
            },
            "didChangeConfiguration": {
                "dynamicRegistration": true
            },
            "didChangeWatchedFiles": {
                "dynamicRegistration": true
            },
            "symbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                },
                "tagSupport": {
                    "valueSet": [
                        1
                    ]
                }
            },
            "executeCommand": {
                "dynamicRegistration": true
            },
            "configuration": true,
            "workspaceFolders": true
        },
        "textDocument": {
            "publishDiagnostics": {
                "relatedInformation": true,
                "versionSupport": false,
                "tagSupport": {
                    "valueSet": [
                        1,
                        2
                    ]
                }
            },
            "synchronization": {
                "dynamicRegistration": true,
                "willSave": true,
                "willSaveWaitUntil": true,
                "didSave": true
            },
            "completion": {
                "dynamicRegistration": true,
                "contextSupport": true,
                "completionItem": {
                    "snippetSupport": true,
                    "commitCharactersSupport": true,
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "deprecatedSupport": true,
                    "preselectSupport": true
                },
                "completionItemKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25
                    ]
                }
            },
            "hover": {
                "dynamicRegistration": true,
                "contentFormat": [
                    "markdown",
                    "plaintext"
                ]
            },
            "signatureHelp": {
                "dynamicRegistration": true,
                "signatureInformation": {
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "parameterInformation": {
                        "labelOffsetSupport": true
                    }
                }
            },
            "definition": {
                "dynamicRegistration": true
            },
            "references": {
                "dynamicRegistration": true
            },
            "documentHighlight": {
                "dynamicRegistration": true
            },
            "documentSymbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                },
                "hierarchicalDocumentSymbolSupport": true,
                "tagSupport": {
                    "valueSet": [
                        1
                    ]
                }
            },
            "codeAction": {
                "dynamicRegistration": true,
                "isPreferredSupport": true,
                "codeActionLiteralSupport": {
                    "codeActionKind": {
                        "valueSet": [
                            "",
                            "quickfix",
                            "refactor",
                            "refactor.extract",
                            "refactor.inline",
                            "refactor.rewrite",
                            "source",
                            "source.organizeImports"
                        ]
                    }
                }
            },
            "codeLens": {
                "dynamicRegistration": true
            },
            "formatting": {
                "dynamicRegistration": true
            },
            "rangeFormatting": {
                "dynamicRegistration": true
            },
            "onTypeFormatting": {
                "dynamicRegistration": true
            },
            "rename": {
                "dynamicRegistration": true,
                "prepareSupport": true
            },
            "documentLink": {
                "dynamicRegistration": true,
                "tooltipSupport": true
            },
            "typeDefinition": {
                "dynamicRegistration": true
            },
            "implementation": {
                "dynamicRegistration": true
            },
            "declaration": {
                "dynamicRegistration": true
            },
            "colorProvider": {
                "dynamicRegistration": true
            },
            "foldingRange": {
                "dynamicRegistration": true,
                "rangeLimit": 5000,
                "lineFoldingOnly": true
            },
            "selectionRange": {
                "dynamicRegistration": true
            }
        },
        "window": {
            "workDoneProgress": true
        }
    },
    "initializationOptions": {
        "linters": {
            "eslint": {
                "command": "./node_modules/.bin/eslint",
                "rootPatterns": [
                    ".git"
                ],
                "debounce": 100,
                "args": [
                    "--stdin",
                    "--stdin-filename",
                    "%filepath",
                    "--format",
                    "json"
                ],
                "sourceName": "eslint",
                "parseJson": {
                    "errorsRoot": "[0].messages",
                    "line": "line",
                    "column": "column",
                    "endLine": "endLine",
                    "endColumn": "endColumn",
                    "message": "${message} [${ruleId}]",
                    "security": "severity"
                },
                "securities": {
                    "1": "warning",
                    "2": "error"
                }
            },
            "shellcheck": {
                "command": "shellcheck",
                "debounce": 100,
                "args": [
                    "--format",
                    "json",
                    "-"
                ],
                "sourceName": "shellcheck",
                "parseJson": {
                    "line": "line",
                    "column": "column",
                    "endLine": "endLine",
                    "endColumn": "endColumn",
                    "message": "${message} [${code}]",
                    "security": "level"
                },
                "securities": {
                    "error": "error",
                    "warning": "warning",
                    "info": "info",
                    "style": "hint"
                }
            },
            "write-good": {
                "command": "write-good",
                "debounce": 100,
                "args": [
                    "--text=%text"
                ],
                "offsetLine": 0,
                "offsetColumn": 1,
                "sourceName": "write-good",
                "formatLines": 1,
                "formatPattern": [
                    "(.*)\\s+on\\s+line\\s+(\\d+)\\s+at\\s+column\\s+(\\d+)\\s*$",
                    {
                        "line": 2,
                        "column": 3,
                        "message": 1
                    }
                ]
            },
            "vint": {
                "command": "vint",
                "debounce": 100,
                "args": [
                    "--enable-neovim",
                    "-"
                ],
                "offsetLine": 0,
                "offsetColumn": 0,
                "sourceName": "vint",
                "formatLines": 1,
                "formatPattern": [
                    "[^:]+:(\\d+):(\\d+):\\s*(.*)(\\r|\\n)*$",
                    {
                        "line": 1,
                        "column": 2,
                        "message": 3
                    }
                ]
            },
            "languagetool": {
                "command": "languagetool",
                "debounce": 200,
                "args": [
                    "-"
                ],
                "offsetLine": 0,
                "offsetColumn": 0,
                "sourceName": "languagetool",
                "formatLines": 2,
                "formatPattern": [
                    "^\\d+?\\.\\)\\s+Line\\s+(\\d+),\\s+column\\s+(\\d+),\\s+([^\\n]+)\nMessage:\\s+(.*)(\\r|\\n)*$",
                    {
                        "line": 1,
                        "column": 2,
                        "message": [
                            4,
                            3
                        ]
                    }
                ]
            },
            "markdownlint": {
                "command": "markdownlint",
                "isStderr": true,
                "debounce": 100,
                "args": [
                    "--stdin"
                ],
                "offsetLine": 0,
                "offsetColumn": 0,
                "sourceName": "markdownlint",
                "formatLines": 1,
                "formatPattern": [
                    "^.*?:\\s+(\\d+):\\s+(.*)(\\r|\\n)*$",
                    {
                        "line": 1,
                        "column": -1,
                        "message": 2
                    }
                ]
            },
            "phpcs": {
                "command": "./vendor/bin/phpcs",
                "debounce": 100,
                "rootPatterns": [
                    "composer.json",
                    "composer.lock",
                    "vendor",
                    ".git"
                ],
                "args": [
                    "--standard=PSR2",
                    "--report=emacs",
                    "-s",
                    "-"
                ],
                "offsetLine": 0,
                "offsetColumn": 0,
                "sourceName": "phpcs",
                "formatLines": 1,
                "formatPattern": [
                    "^.*:(\\d+):(\\d+):\\s+(.*)\\s+-\\s+(.*)(\\r|\\n)*$",
                    {
                        "line": 1,
                        "column": 2,
                        "message": 4,
                        "security": 3
                    }
                ],
                "securities": {
                    "error": "error",
                    "warning": "warning"
                }
            },
            "mix_credo": {
                "command": "mix",
                "debounce": 100,
                "rootPatterns": [
                    "mix.exs"
                ],
                "args": [
                    "credo",
                    "suggest",
                    "--format",
                    "flycheck",
                    "--read-from-stdin"
                ],
                "offsetLine": 0,
                "offsetColumn": 0,
                "sourceName": "mix_credo",
                "formatLines": 1,
                "formatPattern": [
                    "^[^ ]+?:([0-9]+)(:([0-9]+))?:\\s+([^ ]+):\\s+(.*)(\\r|\\n)*$",
                    {
                        "line": 1,
                        "column": 3,
                        "message": 5,
                        "security": 4
                    }
                ],
                "securities": {
                    "F": "warning",
                    "C": "warning",
                    "D": "info",
                    "R": "info"
                }
            },
            "mix_credo_compile": {
                "command": "mix",
                "debounce": 100,
                "rootPatterns": [
                    "mix.exs"
                ],
                "args": [
                    "credo",
                    "suggest",
                    "--format",
                    "flycheck",
                    "--read-from-stdin"
                ],
                "offsetLine": -1,
                "offsetColumn": 0,
                "sourceName": "mix_credo",
                "formatLines": 1,
                "formatPattern": [
                    "^([^ ]+)\\s+\\(([^)]+)\\)\\s+([^ ]+?):([0-9]+):\\s+(.*)(\\r|\\n)*$",
                    {
                        "line": -1,
                        "column": -1,
                        "message": [
                            "[",
                            2,
                            "]: ",
                            3,
                            ": ",
                            5
                        ],
                        "security": 1
                    }
                ],
                "securities": {
                    "**": "error"
                }
            },
            "stylelint": {
                "command": "./node_modules/.bin/stylelint",
                "rootPatterns": [
                    ".git"
                ],
                "debounce": 100,
                "args": [
                    "--formatter",
                    "json",
                    "--stdin-filename",
                    "%filepath"
                ],
                "sourceName": "stylelint",
                "parseJson": {
                    "errorsRoot": "[0].warnings",
                    "line": "line",
                    "column": "column",
                    "message": "${text}",
                    "security": "severity"
                },
                "securities": {
                    "error": "error",
                    "warning": "warning"
                }
            },
            "standard": {
                "command": "./node_modules/.bin/standard",
                "isStderr": false,
                "isStdout": true,
                "args": [
                    "--stdin",
                    "--verbose"
                ],
                "rootPatterns": [
                    ".git"
                ],
                "debounce": 100,
                "offsetLine": 0,
                "offsetColumn": 0,
                "sourceName": "standard",
                "formatLines": 1,
                "formatPattern": [
                    "^\\s*<\\w+>:(\\d+):(\\d+):\\s+(.*)(\\r|\\n)*$",
                    {
                        "line": 1,
                        "column": 2,
                        "message": 3
                    }
                ]
            },
            "hadolint": {
                "command": "hadolint",
                "sourceName": "hadolint",
                "args": [
                    "-f",
                    "json",
                    "-"
                ],
                "parseJson": {
                    "line": "line",
                    "column": "column",
                    "security": "level",
                    "message": "${message} [${code}]"
                },
                "securities": {
                    "error": "error",
                    "warning": "warning",
                    "info": "info",
                    "style": "hint"
                }
            },
            "golangci-lint": {
                "command": "golangci-lint",
                "rootPatterns": [
                    ".git",
                    "go.mod"
                ],
                "debounce": 100,
                "args": [
                    "run",
                    "--out-format",
                    "json"
                ],
                "sourceName": "golangci-lint",
                "parseJson": {
                    "sourceName": "Pos.Filename",
                    "sourceNameFilter": true,
                    "errorsRoot": "Issues",
                    "line": "Pos.Line",
                    "column": "Pos.Column",
                    "message": "${Text} [${FromLinter}]"
                }
            },
            "revive": {
                "command": "revive",
                "rootPatterns": [
                    ".git",
                    "go.mod"
                ],
                "debounce": 100,
                "args": [
                    "%file"
                ],
                "sourceName": "revive",
                "formatPattern": [
                    "^[^:]+:(\\d+):(\\d+):\\s+(.*)$",
                    {
                        "line": 1,
                        "column": 2,
                        "message": [
                            3
                        ]
                    }
                ]
            },
            "phpstan": {
                "command": "./vendor/bin/phpstan",
                "debounce": 100,
                "rootPatterns": [
                    "composer.json",
                    "composer.lock",
                    "vendor",
                    ".git"
                ],
                "args": [
                    "analyze",
                    "--error-format",
                    "raw",
                    "--no-progress",
                    "%file"
                ],
                "offsetLine": 0,
                "offsetColumn": 0,
                "sourceName": "phpstan",
                "formatLines": 1,
                "formatPattern": [
                    "^[^:]+:(\\d+):(.*)(\\r|\\n)*$",
                    {
                        "line": 1,
                        "message": 2
                    }
                ]
            },
            "psalm": {
                "command": "./vendor/bin/psalm",
                "debounce": 100,
                "rootPatterns": [
                    "composer.json",
                    "composer.lock",
                    "vendor",
                    ".git"
                ],
                "args": [
                    "--output-format=emacs",
                    "--no-progress"
                ],
                "offsetLine": 0,
                "offsetColumn": 0,
                "sourceName": "psalm",
                "formatLines": 1,
                "formatPattern": [
                    "^[^:]+:(\\d):(\\d):(.*)\\s-\\s(.*)(\\r|\\n)*$",
                    {
                        "line": 1,
                        "column": 2,
                        "message": 4,
                        "security": 3
                    }
                ],
                "securities": {
                    "error": "error",
                    "warning": "warning"
                },
                "requiredFiles": [
                    "psalm.xml"
                ]
            },
            "tidy": {
                "command": "tidy",
                "args": [
                    "-e",
                    "-q"
                ],
                "rootPatterns": [
                    ".git/"
                ],
                "isStderr": true,
                "debounce": 100,
                "offsetLine": 0,
                "offsetColumn": 0,
                "sourceName": "tidy",
                "formatLines": 1,
                "formatPattern": [
                    "^.*?(\\d+).*?(\\d+)\\s+-\\s+([^:]+):\\s+(.*)(\\r|\\n)*$",
                    {
                        "line": 1,
                        "column": 2,
                        "endLine": 1,
                        "endColumn": 2,
                        "message": [
                            4
                        ],
                        "security": 3
                    }
                ],
                "securities": {
                    "Error": "error",
                    "Warning": "warning"
                }
            },
            "nix-linter": {
                "command": "nix-linter",
                "sourceName": "nix-linter",
                "debounce": 100,
                "parseJson": {
                    "line": "pos.spanBegin.sourceLine",
                    "column": "pos.spanBegin.sourceColumn",
                    "endLine": "pos.spanEnd.sourceLine",
                    "endColumn": "pos.spanEnd.sourceColumn",
                    "message": "${description}"
                },
                "securities": {
                    "undefined": "warning"
                }
            },
            "yamllint": {
                "args": [
                    "-f",
                    "parsable",
                    "-"
                ],
                "command": "yamllint",
                "debounce": 100,
                "formatLines": 1,
                "formatPattern": [
                    "^.*?:(\\d+):(\\d+): \\[(.*?)] (.*) \\((.*)\\)",
                    {
                        "line": 1,
                        "endline": 1,
                        "column": 2,
                        "endColumn": 2,
                        "message": 4,
                        "code": 5,
                        "security": 3
                    }
                ],
                "securities": {
                    "error": "error",
                    "warning": "warning"
                },
                "sourceName": "yamllint"
            },
            "fish": {
                "command": "fish",
                "args": [
                    "-n",
                    "%file"
                ],
                "isStdout": false,
                "isStderr": true,
                "sourceName": "fish",
                "formatLines": 1,
                "formatPattern": [
                    "^.*\\(line (\\d+)\\): (.*)$",
                    {
                        "line": 1,
                        "message": 2
                    }
                ]
            }
        },
        "filetypes": {
            "sh": "shellcheck",
            "vim": "vint"
        },
        "formatters": {
            "dartfmt": {
                "command": "dartfmt",
                "args": [
                    "--fix"
                ]
            },
            "mix_format": {
                "command": "mix",
                "args": [
                    "format",
                    "-"
                ]
            },
            "stylelint": {
                "command": "./node_modules/.bin/stylelint",
                "args": [
                    "--fix"
                ],
                "rootPatterns": [
                    ".git"
                ],
                "isStderr": false,
                "isStdout": true
            },
            "standard": {
                "command": "./node_modules/.bin/standard",
                "args": [
                    "--stdin",
                    "--fix"
                ],
                "rootPatterns": [
                    ".git"
                ],
                "isStderr": false,
                "isStdout": true
            },
            "lua-format": {
                "command": "lua-format",
                "args": [
                    "-i"
                ]
            },
            "shfmt": {
                "command": "shfmt"
            },
            "tffmt": {
                "command": "terraform",
                "args": [
                    "fmt",
                    "-"
                ]
            },
            "blade-formatter": {
                "command": "blade-formatter",
                "args": [
                    "--stdin"
                ]
            },
            "nixfmt": {
                "command": "nixfmt"
            },
            "fish_indent": {
                "command": "fish_indent"
            }
        },
        "formatFiletypes": {
            "terraform": "tffmt",
            "sh": "shfmt"
        }
    },
    "trace": "verbose",
    "workspaceFolders": [
        {
            "uri": "file:///Users/moshe.avni/src/dotfiles",
            "name": "dotfiles"
        }
    ],
    "clientInfo": {
        "name": "coc.nvim",
        "version": "0.0.79"
    }
}

[Trace - 10:13:48 AM] Received response 'initialize - (0)' in 202ms.
Result: {
    "capabilities": {
        "textDocumentSync": 2,
        "documentFormattingProvider": true
    }
}

[Trace - 10:13:48 AM] Sending notification 'initialized'.
Params: {}

[Trace - 10:13:48 AM] Sending notification 'textDocument/didOpen'.
Params: {
    "textDocument": {
        "uri": "file:///Users/moshe.avni/src/dotfiles/.vimrc",
        "languageId": "vim",
        "version": 1,
        "text": " ~~~myvimrccontent~~~ "
    }
}

[Trace - 10:13:49 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/moshe.avni/src/dotfiles/.vimrc",
    "diagnostics": []
}
iamcco commented 3 years ago

vint's problem for stdin input.

mosheavni commented 3 years ago

vint's problem for stdin input.

What does that mean? Can we fix it somehow?

iamcco commented 3 years ago

You can test cat .vimrc | vint --enable-neovim - refer https://github.com/Vimjas/vint/issues/305

yaegassy commented 3 years ago

The version of "vint" may be outdated.

It is possible to install 0.4a3 by specifying --pre with the pip3 command.

Or you can also install it directly from the repository.

# version: 0.4a3
pip3 install --pre vim-vint

# version: 0.4a4.dev9+g9078dd6
pip3 install git+https://github.com/Vimjas/vint
mosheavni commented 3 years ago

Thanks @yaegassy it's working now:

pip3 uninstall vim-vint
pip3 install --pre vim-vint
randallwc commented 2 years ago

on mac to fix you can also do

brew install vint --HEAD