iamcco / coc-diagnostic Goto Github PK
View Code? Open in Web Editor NEWdiagnostic-languageserver extension for coc.nvim
diagnostic-languageserver extension for coc.nvim
I am evaluating whether I should migrate my current vim setup from using ALE for linting to this coc extension. What is currently a problem for me is the lack of default configurations for linters. It would be nice if there was a set of preconfigured linters or at least an example from where to copy and paste definitions for common linters. Maybe this could be sourced from the ALE linter definitions?
I have a problem with ansible-lint integration with coc-diagnostic.
This linter can check files only recursive.
There is a link on problem: ansible/ansible-lint#667
There is a my config for it:
"ansible-lint": {
"command": "ansible-lint",
"isStderr": false,
"isStdout": true,
"args": [
"--parseable-severity",
"%filepath"
],
"rootPatterns": ["ansible.cfg"],
"debounce": 100,
"offsetLine": 0,
"offsetColumn": 0,
"sourceName": "ansible-lint",
"formatLines": 1,
"formatPattern": [
"^[^:]+:(\\d+):\\s(\\S+)\\s\\[(\\S+)\\]\\s(.*)$",
{
"line": 1,
"security": 3,
"message": [2, " [", 3, "] ", 4]
}
],
"securities": {
"VERY_HIGHT": "error",
"HIGHT": "error",
"MEDIUM": "warning",
"LOW": "warning",
"VERY_LOW": "warning",
"INFO": "info"
}
}
Can i somehow to ignore not needed output about another files?
I was write this stupid small script and add it to coc-settings config, but ,it did not work with coc-diagnostic, i don't know why:
#!/bin/bash
path=$1
pathCutted=$(echo $path | cut -c 2-)
cd / && ansible-lint --parseable-severity $path | grep $pathCutted
I have an updated version of Coc.vim. I run :CocInstall coc-diagnostic
and then add the following to my coc-settings.json
:
"diagnostic-languageserver.filetypes": {
"sh": "shellcheck"
},
"diagnostic-languageserver.formatFiletypes": {
"sh": "shfmt"
}
Every time I start Neovim I get an error:
[coc.nvim] settings file parse error, run ':CocList diagnostics'
I run :CocList diagnostics
and I get:
/Users/bob/.config/nvim/coc-settings.json:1:38 Error [config] end of file expected
With shellcheck in path I just do CocInstall coc-diagnostic and then add the following lines to the CocConfig.
"diagnostic-languageserver.linters": {
"sh": "shellcheck",
}
That should be it right ?
Hello,
After much struggle I was able to make phpcs
lint my WordPress files.
The problem now is, is that phpcbf
(The formatter) is not taking the local project configuration. The files get formatted but not to the correct standard.
This is my complete coc-settings.json
:
{
"coc.preferences.formatOnSaveFiletypes": ["php", "json"],
"diagnostic-languageserver.filetypes": {
"php": ["phpcs"]
},
"diagnostic-languageserver.linters": {
"phpcs": {
"command": "./vendor/bin/phpcs",
"debounce": 100,
"rootPatterns": ["composer.json", "composer.lock", "vendor", ".git"],
"args": ["--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"
}
}
},
"diagnostic-languageserver.formatFiletypes": {
"php": "phpcbf"
},
"diagnostic-languageserver.formatters": {
"phpcbf": {
"command": "./vendor/bin/phpcbf",
"rootPatterns": ["composer.json", "composer.lock", "vendor", ".git"],
"args": ["-"]
}
}
}
I tried to add , but no linting appears. Here is how it looks in terminal:
[I] /home/sporty/clojure/bubbleuptop~> clj-kondo --lint src/bubbleuptop/bubbleuptop.clj
src/bubbleuptop/bubbleuptop.clj:5:14: warning: namespace ring.middleware.reload is required but never used
src/bubbleuptop/bubbleuptop.clj:5:45: warning: #'ring.middleware.reload/wrap-reload is referred but never used
src/bubbleuptop/bubbleuptop.clj:8:2: error: unresolved symbol error
src/bubbleuptop/bubbleuptop.clj:10:16: warning: unused binding request
src/bubbleuptop/bubbleuptop.clj:17:6: warning: unused binding args
linting took 8ms, errors: 1, warnings: 4
Here is what I tried, but no linting appears:
{
"coc.source.iced.enable": true,
"coc.preferences.useQuickfixForLocations": true,
"suggest.snippetIndicator": "๐ฆ",
"languageserver": {
"dls": {
"command": "diagnostic-languageserver",
"args": ["--stdio"],
"filetypes": [ "clj", "edn", "cljs", "clojure" ],
"initializationOptions": {
"linters": {
"clj-kondo": {
"command": "clj-condo",
"debounce": 100,
"args": [ "--lint", "%filepath"],
"offsetLine": 0,
"offsetColumn": 0,
"sourceName": "clj-kondo",
"formatLines": 1,
"formatPattern": [
"^[^:]+:(\\d+):(\\d+):\\s+([^:]+):\\s+(.*)$",
{
"line": 1,
"column": 2,
"message": 4,
"security": 3
}
],
"securities": {
"error": "error",
"warning": "warning",
"note": "info"
}
}
},
"filetypes": {
"clj":"clj-kondo",
"clojure":"clj-kondo"
}
}
}
}
}
Describe the bug
Can't get nix-linter to work.
To Reproduce
Steps to reproduce the behavior:
nix-linter somefile.nix
works and outputs human-readable warningsnix-linter --json somefile.nix
outputs the same in jsondiagnostic-languageserver.filetypes.nix = "nix-linter";
diagnostic-languageserver.mergeConfig = true;
diagnostic-languageserver.linters.nix-linter.args = [ "--json" "%filepath"];
so that it at least outputs json we're expecting
nvim somefile.nix
:CocInfo
, see## Output channel: diagnostic-languageserver
[Error - 03.08.02] [nix] diagnostic handle fail: [nix-linter] (intermediate value)(intermediate value)(intermediate value).map is not a function
Expected behavior
I expect to see warnings from nix-linter and no errors in :CocInfo
Desktop (please complete the following information):
Log:
2020-11-12T03:10:55.396 INFO (pid:28952) [services] - registered service "languageserver.bash"
2020-11-12T03:10:55.398 INFO (pid:28952) [services] - registered service "languageserver.ccls"
2020-11-12T03:10:55.398 INFO (pid:28952) [services] - registered service "languageserver.nix"
2020-11-12T03:10:55.403 INFO (pid:28952) [services] - nix state change: stopped => starting
2020-11-12T03:10:55.403 INFO (pid:28952) [services] - registered service "languageserver.python"
2020-11-12T03:10:55.469 INFO (pid:28952) [services] - registered service "highlight"
2020-11-12T03:10:55.498 INFO (pid:28952) [services] - registered service "diagnostic-languageserver"
2020-11-12T03:10:55.498 INFO (pid:28952) [services] - diagnostic language service state change: stopped => starting
2020-11-12T03:10:55.500 INFO (pid:28952) [plugin] - coc.nvim 0.0.78-9f9d8a32c4 initialized with node: v12.18.4 after 197ms
2020-11-12T03:10:55.506 INFO (pid:28952) [language-client-index] - Language server "languageserver.nix" started with 28971
2020-11-12T03:10:55.519 INFO (pid:28952) [language-client-index] - highlight started with 28974
2020-11-12T03:10:55.526 INFO (pid:28952) [language-client-index] - diagnostic-languageserver started with 28980
2020-11-12T03:10:55.542 INFO (pid:28952) [services] - nix state change: starting => running
2020-11-12T03:10:55.549 INFO (pid:28952) [services] - service languageserver.nix started
2020-11-12T03:10:55.677 INFO (pid:28952) [services] - diagnostic language service state change: starting => running
2020-11-12T03:10:55.678 INFO (pid:28952) [services] - service diagnostic-languageserver started
Other linters work fine.
WARNING in ./node_modules/colors/colors.js 219:30-44
Critical dependency: the request of a dependency is an expression
@ ./node_modules/findup/index.js
@ ./node_modules/diagnostic-languageserver/lib/common/util.js
@ ./node_modules/diagnostic-languageserver/lib/handles/handleDiagnostic.js
@ ./node_modules/diagnostic-languageserver/lib/index.js
@ ./src/server.ts
Looks to be caused by a very old version of colors https://github.com/Filirom1/findup/blob/master/package.json#L17 depended on by a very old findup package used in diagnostic-languageserver. https://github.com/iamcco/diagnostic-languageserver/blob/master/src/common/util.ts#L9. I guess it should be switched to use the more popular find-up package https://github.com/sindresorhus/find-up#readme or https://github.com/choojs/findup which removes the colors
dependency.
See:
I wished I could set some specific linter to run just on file-save. Coc is currently in default mode (diagnostic on insert leave), which is fine for all language servers, and some light linters of coc-diagnostic, but for example, the textidote tool takes too much processing to check Markdown/LaTeX, so I wished just this one to run on file-save only.
Hi,
I'm new to coc. I'm missing an easy getting started guide for coc-diagnostic (i.e. what's the relation to https://github.com/iamcco/diagnostic-languageserver ?). I can't get coc-diagnostic to work based on the README.md of this project.
Do I need both projects to get it working ?
Hi thanks for this great extension.
Just wondering if it's possible to disable diagnostics on some filetypes? for example, markdown.
I know "diagnostic.enable": false
in coc-settings.json
works but that would disable every filetype.
also tried
autocmd FileType markdown let b:coc_suggest_disable = 1
but that only works for suggestions. Would be great to know if there's another flag works for diagnostics.
Vint shows some errors like "Not an editor command" but not other style errors I get when running the CLI command.
I think it's because of this error on the CocInfo
:
## versions
vim version: NVIM v0.4.3
node version: v10.18.1
coc.nvim version: 0.0.74-98a709ec3f
term: Apple_Terminal
platform: darwin
## Messages
## Output channel: diagnostic-languageserver
Linter command: vint, args: ["--enable-neovim","-"]
stdout:
stderr: Traceback (most recent call last):
File "/usr/local/bin/vint", line 10, in <module>
sys.exit(main())
File "/usr/local/lib/python3.7/site-packages/vint/__init__.py", line 11, in main
init_cli()
File "/usr/local/lib/python3.7/site-packages/vint/bootstrap.py", line 22, in init_cli
cli.start()
File "/usr/local/lib/python3.7/site-packages/vint/linting/cli.py", line 27, in start
violations = self._lint_all(env, config_dict)
File "/usr/local/lib/python3.7/site-packages/vint/linting/cli.py", line 121, in _lint_all
violations += linter.lint_text(sys.stdin.read())
File "/usr/local/lib/python3.7/site-packages/vint/linting/linter.py", line 132, in lint_text
self._traverse(root_ast, 'stdin')
File "/usr/local/lib/python3.7/site-packages/vint/linting/linter.py", line 150, in _traverse
on_leave=lambda node: self._handle_leave(node, lint_context))
File "/usr/local/lib/python3.7/site-packages/vint/ast/traversing.py", line 234, in traverse
should_traverse_children = on_enter(node) is not SKIP_CHILDREN
File "/usr/local/lib/python3.7/site-packages/vint/linting/linter.py", line 149, in <lambda>
on_enter=lambda node: self._handle_enter(node, lint_context),
File "/usr/local/lib/python3.7/site-packages/vint/linting/linter.py", line 160, in _handle_enter
self._fire_listeners(node, lint_context)
File "/usr/local/lib/python3.7/site-packages/vint/linting/linter.py", line 178, in _fire_listeners
violation = listening_policy.get_violation_if_found(node, lint_context)
File "/usr/local/lib/python3.7/site-packages/vint/linting/policy/abstract_policy.py", line 38, in get_violation_if_found
if self.is_valid(node, lint_context):
File "/usr/local/lib/python3.7/site-packages/vint/linting/policy/prohibit_missing_scriptencoding.py", line 36, in is_valid
return not self._check_script_has_multibyte_char(lint_context)
File "/usr/local/lib/python3.7/site-packages/vint/linting/policy/prohibit_missing_scriptencoding.py", line 54, in _check_script_has_multibyte_char
return self._check_stdin_has_multibyte_char()
File "/usr/local/lib/python3.7/site-packages/vint/linting/policy/prohibit_missing_scriptencoding.py", line 64, in _check_stdin_has_multibyte_char
sys.stdin.seek(0)
io.UnsupportedOperation: underlying stream is not seekable
match string:
match result: null
My vint version is: 0.3.21
Command: yarn install --frozen-lockfile
Message:
yarn install v1.22.4
[1/5] Validating package.json...
warning [email protected]: The engine "coc" appears to be invalid.
[2/5] Resolving packages...
success Already up-to-date.
$ build
/bin/sh: 1: build: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
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):
[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": []
}
Hello and thanks for this excellent extension.
I'm trying to use the extension on a WordPress project which has its own format standard with no success.
I can configure the standard just fine by placing a phpcs.xml.dist
file much like this one in the root of my project, so when I execute ./vendor/bin/phpcs
and ./vendor/bin/phpcbf
the code gets linted and formatted.
So my request would be for a way to change the args of the linter and formatter since they seem to be fixed: https://github.com/iamcco/coc-diagnostic/blob/master/src/config.ts#L136)
Thanks in advance
(Continuing from #18.)
An empty test.html
file.
Typing <dic
into the test HTML file.
Output of :CocInfo
:
## versions
vim version: NVIM v0.5.0-357-g405f49a9b
node version: v12.13.0
coc.nvim version: 0.0.74-6700e7468d
term: undefined
platform: win32
## Messages
## Output channel: git
Looking for git in: git
> git rev-parse --show-toplevel
fatal: not a git repository (or any of the parent directories): .git
Error 128 on: 'git rev-parse --show-toplevel' in c:\Users\***\Desktop
fatal: not a git repository (or any of the parent directories): .git
## Output channel: snippets
Output of :CocOpenLog
:
2020-02-09T23:45:13.035 INFO (pid:4272) [services] - registered service "languageserver.clangd"
2020-02-09T23:45:13.100 INFO (pid:4272) [services] - registered service "html"
2020-02-09T23:45:13.100 INFO (pid:4272) [services] - HTML language server state change: stopped => starting
2020-02-09T23:45:13.110 INFO (pid:4272) [services] - registered service "diagnostic-languageserver"
2020-02-09T23:45:13.110 INFO (pid:4272) [services] - diagnostic language service state change: stopped => starting
2020-02-09T23:45:13.183 INFO (pid:4272) [language-client-index] - html started with 7368
2020-02-09T23:45:13.205 INFO (pid:4272) [language-client-index] - diagnostic-languageserver started with 12764
2020-02-09T23:45:13.268 INFO (pid:4272) [plugin] - coc 0.0.74-6700e7468d initialized with node: v12.13.0
2020-02-09T23:45:13.291 INFO (pid:4272) [language-client-index] - cSpell started with 3712
2020-02-09T23:45:13.304 INFO (pid:4272) [services] - diagnostic language service state change: starting => running
2020-02-09T23:45:13.307 INFO (pid:4272) [services] - service diagnostic-languageserver started
2020-02-09T23:45:13.499 INFO (pid:4272) [services] - HTML language server state change: starting => running
2020-02-09T23:45:13.501 INFO (pid:4272) [services] - service html started
Output of :CocInfo
is not changed.
Output of :CocOpenLog
is changed:
2020-02-09T23:45:13.035 INFO (pid:4272) [services] - registered service "languageserver.clangd"
2020-02-09T23:45:13.100 INFO (pid:4272) [services] - registered service "html"
2020-02-09T23:45:13.100 INFO (pid:4272) [services] - HTML language server state change: stopped => starting
2020-02-09T23:45:13.110 INFO (pid:4272) [services] - registered service "diagnostic-languageserver"
2020-02-09T23:45:13.110 INFO (pid:4272) [services] - diagnostic language service state change: stopped => starting
2020-02-09T23:45:13.183 INFO (pid:4272) [language-client-index] - html started with 7368
2020-02-09T23:45:13.205 INFO (pid:4272) [language-client-index] - diagnostic-languageserver started with 12764
2020-02-09T23:45:13.268 INFO (pid:4272) [plugin] - coc 0.0.74-6700e7468d initialized with node: v12.13.0
2020-02-09T23:45:13.291 INFO (pid:4272) [language-client-index] - cSpell started with 3712
2020-02-09T23:45:13.304 INFO (pid:4272) [services] - diagnostic language service state change: starting => running
2020-02-09T23:45:13.307 INFO (pid:4272) [services] - service diagnostic-languageserver started
2020-02-09T23:45:13.499 INFO (pid:4272) [services] - HTML language server state change: starting => running
2020-02-09T23:45:13.501 INFO (pid:4272) [services] - service html started
2020-02-09T23:47:39.244 INFO (pid:4272) [completion-complete] - Results from: html
2020-02-09T23:47:51.394 INFO (pid:4272) [willSaveHandler] - Will save cost: 1
Additionally, while testing on the Ubuntu 16.04 machine:
At this moment, the file is still empty but the gutter shows a warning symbol, and with 1 warning showing in :CocList diagnostics
. The output of :CocOpenLog
2020-02-09T23:51:23.049 INFO (pid:12140) [services] - registered service "languageserver.clangd"
2020-02-09T23:51:23.068 INFO (pid:12140) [services] - registered service "diagnostic-languageserver"
2020-02-09T23:51:23.068 INFO (pid:12140) [services] - diagnostic language service state change: stopped => starting
2020-02-09T23:51:23.100 INFO (pid:12140) [services] - registered service "html"
2020-02-09T23:51:23.100 INFO (pid:12140) [services] - HTML language server state change: stopped => starting
2020-02-09T23:51:23.172 INFO (pid:12140) [language-client-index] - diagnostic-languageserver started with 12154
2020-02-09T23:51:23.179 INFO (pid:12140) [language-client-index] - html started with 12160
2020-02-09T23:51:23.209 INFO (pid:12140) [plugin] - coc 0.0.74-6700e7468d initialized with node: v12.13.0
2020-02-09T23:51:23.213 INFO (pid:12140) [language-client-index] - cSpell started with 12171
2020-02-09T23:51:23.248 INFO (pid:12140) [services] - diagnostic language service state change: starting => running
2020-02-09T23:51:23.250 INFO (pid:12140) [services] - service diagnostic-languageserver started
2020-02-09T23:51:23.442 INFO (pid:12140) [services] - HTML language server state change: starting => running
2020-02-09T23:51:23.445 INFO (pid:12140) [services] - service html started
At this moment, the gutter shows an error symbol, and with 1 error and 4 warnings showing in :CocList diagnostics
.
Output of :CocOpenLog
is changed:
2020-02-09T23:51:23.049 INFO (pid:12140) [services] - registered service "languageserver.clangd"
2020-02-09T23:51:23.068 INFO (pid:12140) [services] - registered service "diagnostic-languageserver"
2020-02-09T23:51:23.068 INFO (pid:12140) [services] - diagnostic language service state change: stopped => starting
2020-02-09T23:51:23.100 INFO (pid:12140) [services] - registered service "html"
2020-02-09T23:51:23.100 INFO (pid:12140) [services] - HTML language server state change: stopped => starting
2020-02-09T23:51:23.172 INFO (pid:12140) [language-client-index] - diagnostic-languageserver started with 12154
2020-02-09T23:51:23.179 INFO (pid:12140) [language-client-index] - html started with 12160
2020-02-09T23:51:23.209 INFO (pid:12140) [plugin] - coc 0.0.74-6700e7468d initialized with node: v12.13.0
2020-02-09T23:51:23.213 INFO (pid:12140) [language-client-index] - cSpell started with 12171
2020-02-09T23:51:23.248 INFO (pid:12140) [services] - diagnostic language service state change: starting => running
2020-02-09T23:51:23.250 INFO (pid:12140) [services] - service diagnostic-languageserver started
2020-02-09T23:51:23.442 INFO (pid:12140) [services] - HTML language server state change: starting => running
2020-02-09T23:51:23.445 INFO (pid:12140) [services] - service html started
2020-02-09T23:55:17.143 INFO (pid:12140) [completion-complete] - Results from: html
2020-02-09T23:59:02.262 INFO (pid:12140) [willSaveHandler] - Will save cost: 4
Hi,
I am having some trouble installing the plugin.
I use :CocInstall coc-diagnostic
and vim reports [coc.nvim] Error on load extension coc-diagnostic from /home/[my name]...les/coc-diagnostic/lib/index.js: Error: Cannot find module 'tslib'
I am very sure I have tslib installed globally.
I am using Windows10 WSL. Maybe this is the problem?
This is my error log:
2019-09-18T22:05:11.242 ERROR (pid:305) [extensions] - { Error: Cannot find module 'tslib'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at req (/home//.vim/bundle/coc.nvim/build/index.js:48915:21)
at Object. (/home//.config/coc/extensions/node_modules/coc-diagnostic/lib/index.js:3:15)
at Module._compile (/home//.vim/bundle/coc.nvim/build/index.js:48936:32)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3) code: 'MODULE_NOT_FOUND' }
Describe the bug
Diagnostic signs only update on write.
To Reproduce
Steps to reproduce the behavior:
Install rubocop gem.
Add config to coc-settings:
"diagnostic-languageserver.filetypes": {
"ruby": ["rubocop"]
},
"diagnostic-languageserver.linters": {
"rubocop": {
"command": "bundle",
"sourceName": "rubocop",
"debounce": 100,
"args": [
"exec",
"rubocop",
"--format",
"json",
"--force-exclusion",
"%filepath"
],
"parseJson": {
"errorsRoot": "files[0].offenses",
"line": "location.line",
"column": "location.column",
"message": "[${cop_name}] ${message}",
"security": "severity"
},
"securities": {
"fatal": "error",
"error": "error",
"warning": "warning",
"convention": "info",
"refactor": "info",
"info": "info"
}
}
}
Create a Ruby file with inline linter exclusion, eg:
# rubocop:disable Metrics/MethodLength
def move
new_coordinates = coordinates
case direction.current
when :north
new_coordinates.y += 1
when :east
new_coordinates.x += 1
when :south
new_coordinates.y -= 1
when :west
new_coordinates.x -= 1
end
self.coordinates = new_coordinates
end
# rubocop:enable Metrics/MethodLength
Remove the exclusion.
Expected behavior
Error should show up in sign column after 100 ms debounce.
Desktop (please complete the following information):
Log:
2021-02-24T22:48:59.704 INFO (pid:36697) [services] - registered service "diagnostic-languageserver"
2021-02-24T22:48:59.722 INFO (pid:36697) [services] - registered service "highlight"
2021-02-24T22:48:59.768 WARN (pid:36697) [attach] - Plugin not ready when received "highlight" []
2021-02-24T22:48:59.794 INFO (pid:36697) [language-client-index] - highlight started with 37099
2021-02-24T22:48:59.808 INFO (pid:36697) [plugin] - coc.nvim 0.0.80-8cfed3b159 initialized with node: v14.2.0 after 201ms
2021-02-24T22:49:02.132 INFO (pid:36697) [attach] - receive notification: highlight []
2021-02-24T22:49:02.145 INFO (pid:36697) [services] - diagnostic language service state change: stopped => starting
2021-02-24T22:49:02.225 INFO (pid:36697) [services] - registered service "solargraph"
2021-02-24T22:49:02.230 INFO (pid:36697) [language-client-index] - diagnostic-languageserver started with 37248
2021-02-24T22:49:02.352 INFO (pid:36697) [services] - diagnostic language service state change: starting => running
2021-02-24T22:49:02.353 INFO (pid:36697) [services] - service diagnostic-languageserver started
2021-02-24T22:49:03.656 INFO (pid:36697) [attach] - receive notification: doAutocmd [
2,
{
regcontents: [ ' # rubocop:disable Metrics/MethodLength' ],
visual: false,
inclusive: false,
regname: '',
operator: 'd',
regtype: 'V'
},
5,
1000
]
2021-02-24T22:49:03.760 INFO (pid:36697) [attach] - receive notification: highlight []
2021-02-24T22:49:12.022 INFO (pid:36697) [attach] - receive notification: openLog []
I'm not being able to get rubocop to work
Env
$ sw_vers
ProductName: macOS
ProductVersion: 11.0.1
BuildVersion: 20B29
:version
NVIM v0.4.4
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu9
9 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS
-D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/tmp/neovim-20200808-89283-1us0ytm/neovim-0.4.4/build/config -I/tmp/neovim-20200808-89283-1us0ytm/
neovim-0.4.4/src -I/usr/local/include -I/tmp/neovim-20200808-89283-1us0ytm/neovim-0.4.4/deps-build/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/us
r/include -I/usr/local/opt/gettext/include -I/tmp/neovim-20200808-89283-1us0ytm/neovim-0.4.4/build/src/nvim/auto -I/tmp/neovim-20200808-89283-1us0ytm/neovim-0.4.4/build
/include
Compiled by brew@Catalina
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/Cellar/neovim/0.4.4/share/nvim"
Run :checkhealth for more info
coc-settings.json
"diagnostic-languageserver.linters": {
"rubocop": {
"command": "bundle exec rubocop",
"sourceName": "rubocop",
"debounce": 100,
"args": [
"--format",
"json",
"--force-exclusion",
"%filepath"
],
"parseJson": {
"errorsRoot": "files[0].offenses",
"line": "location.line",
"column": "location.column",
"message": "[${cop_name}] ${message}",
"security": "severity"
},
"securities": {
"fatal": "error",
"warning": "warning"
}
}
},
"diagnostic-languageserver.filetypes": {
"ruby": "rubocop"
}
Example of the linter
$ bundle exec rubocop --format json --force-exclusion /tmp/a.rb
{"metadata":{"rubocop_version":"1.4.2","ruby_engine":"ruby","ruby_version":"2.7.2","ruby_patchlevel":"137","ruby_platform":"x86_64-darwin19"},"files":[{"path":"/tmp/a.rb","offenses":[{"severity":"fatal","message":"unexpected `@'\n(Using Ruby 2.4 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)","cop_name":"Lint/Syntax","corrected":false,"correctable":false,"location":{"start_line":3,"start_column":3,"last_line":3,"last_column":3,"length":1,"line":3,"column":3}}]}],"summary":{"offense_count":1,"target_file_count":1,"inspected_file_count":1}}
[Trace - 21:54:56] Sending request 'initialize - (0)'.
Params: {
"processId": 8878,
"rootPath": "/private/tmp",
"rootUri": "file:///private/tmp",
"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
}
]
},
"rubocop": {
"command": "bundle exec rubocop",
"sourceName": "rubocop",
"debounce": 100,
"args": [
"--format",
"json",
"--force-exclusion",
"%filepath"
],
"parseJson": {
"errorsRoot": "files[0].offenses",
"line": "location.line",
"column": "location.column",
"message": "[${cop_name}] ${message}",
"security": "severity"
},
"securities": {
"fatal": "error",
"warning": "warning"
}
}
},
"filetypes": {
"markdown": "markdownlint",
"ruby": "rubocop",
"sh": "shellcheck",
"vim": "vint",
"yaml": "yamllint"
},
"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": {}
},
"trace": "verbose",
"workspaceFolders": [
{
"uri": "file:///private/tmp",
"name": "tmp"
}
],
"clientInfo": {
"name": "coc.nvim",
"version": "0.0.79"
}
}
[Trace - 21:54:56] Received response 'initialize - (0)' in 77ms.
Result: {
"capabilities": {
"textDocumentSync": 2,
"documentFormattingProvider": true
}
}
[Trace - 21:54:56] Sending notification 'initialized'.
Params: {}
[Trace - 21:54:56] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///private/tmp/a.rb",
"languageId": "ruby",
"version": 1,
"text": "OO\nclass User < ApplicationRecord\n @@@\nend\n"
}
}
[Trace - 21:54:56] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "found working directory /private/tmp"
}
[Info - 21:54:56] found working directory /private/tmp
[Trace - 21:54:56] Received notification 'window/logMessage'.
Params: {
"type": 1,
"message": "[ruby] diagnostic handle fail: [rubocop] spawn bundle exec rubocop ENOENT"
}
[Error - 21:54:56] [ruby] diagnostic handle fail: [rubocop] spawn bundle exec rubocop ENOENT
[Trace - 21:54:56] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///private/tmp/a.rb",
"diagnostics": []
}
Describe the bug
When multiple PHPStan and PHP_CodeSniffer errors are on the same line, they are not all displayed.
To Reproduce
Steps to reproduce the behavior:
~/.vim/coc-settings.json
:
https://github.com/ngmy/dotfiles/blob/aa0e0f105aa793213c680cf282d8557bc0469cb5/.vim/coc-settings.json
Composer scripts used in the ~/.vim/coc-settings.json
:
"scripts": {
"lint": [
"@php tools/phpcs"
],
"findbugs": [
"@php tools/phpstan analyse --ansi"
],
}
Expected behavior
All PHPStan errors and PHP_CodeSniffer errors are shown.
Screenshots
When the cursor is on the "a"
, some PHPStan errors are not shown.
When the cursor is on the =
, all PHPStan errors are shown, but all PHP_CodeSniffer errors are not.
Desktop (please complete the following information):
Host machine:
Docker container:
Log:
Coc diagnostic crashes with workspace message error: unknown option '--clientProcessId=...'
when it loads a filetype that's configured for diagnostic-languageserver. In short, the extension does not currently work.
"diagnostic-languageserver.filetypes": {
"sh": "shellcheck"
}
When opening a file of type sh
(or any other configured filetype):
On running :CocCommand workspace.showOutput
with "diagnostic-languageserver.trace.server": "verbose"
:
error: unknown option '--clientProcessId=2381'
[Error - 3:26:22 PM] Connection to server got closed. Server will not be restarted.
[Trace - 3:28:53 PM] Sending request 'initialize - (0)'.
Params: {
"processId": 6903,
"rootPath": "/home/sroeca/.config/nvim/pack/packager/start/coc-diagnostic.git",
"rootUri": "file:///home/sroeca/.config/nvim/pack/packager/start/coc-diagnostic.git",
"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",
"%file"
],
"sourceName": "golangci-lint",
"parseJson": {
"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"
}
}
},
"filetypes": {
"sh": "shellcheck"
},
"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"
]
}
},
"formatFiletypes": {}
},
"trace": "verbose",
"workspaceFolders": [
{
"uri": "file:///home/sroeca/.config/nvim/pack/packager/start/coc-diagnostic.git",
"name": "coc-diagnostic.git"
}
],
"clientInfo": {
"name": "coc.nvim",
"version": "0.0.78"
}
}
error: unknown option '--clientProcessId=6903'
Hello. I want to use languagetool
to lint my documents, and it works fine with folowing configuration:
/usr/local/languagetool
#!/bin/bash
java -jar /Users/alexanderpopov/LanguageTool-4.5/languagetool-commandline.jar "$@"
coc-settings.json
...
"diagnostic-languageserver.filetypes": {
"markdown": [ "markdownlint", "languagetool" ],
"javascript": [ "eslint" ],
"sh": "shellcheck"
},
...
The point is - I want to pass arguments to languagetool itself, f.e. --language ru-RU
to check files in russian language, but I can't figure out where I can put my arguments...
Is there a way that I can customize Diagnostics? I want to show the diagnostics in front of the line like lspconfig, also I want to delete that >> sign. How can I do that?
Also I want to show warning when a variable declared, but its value never used
Using default options, stylelint doesn't find the .stylelintrc in project git root,
how might I configure this?
Hello, I'm trying to use your plugin to use coc.nvim for linting instead of ale, here is my coc-settings:
{
"languageserver": {
"golang": {
"command": "bingo",
"filetypes": ["go"],
"rootPatterns": ["go.mod"]
},
"sh": {
"command": "bash-language-server",
"args": ["start"],
"filetypes": ["sh"],
"ignoredRootPaths": ["~"]
},
"dockerfile": {
"command": "docker-langserver",
"filetypes": ["dockerfile"],
"args": ["--stdio"]
}
},
"diagnostic-languageserver.filetypes": {
"email": "languagetool",
"markdown": [ "write-good", "markdownlint" ],
"sh": "shellcheck",
"elixir": ["mix_credo", "mix_credo_compile"],
"eelixir": ["mix_credo", "mix_credo_compile"]
},
"diagnostic-languageserver.formatFiletypes": {
"dart": "dartfmt",
"elixir": "mix_format",
"eelixir": "mix_format"
}
}
When I open .sh file I see following error:
[coc.nvim] Error output from diagnostic-languageserver: [sh] diagnostic handle fail: spawn shellcheck ENOENT
the same for .md file:
[coc.nvim] Error output from diagnostic-languageserver: [markdown] diagnostic handle fail: spawn markdownlint ENOENT
Describe the bug
I've configured the "vim" filetype to use the "vint" linter but I'm not getting any hints about problems that vint would have found.
To Reproduce
coc-settings.json:
{
"diagnostic-languageserver.filetypes": {
"vim": "vint",
"sh": "shellcheck"
}
}
shellcheck does work, but vint doesn't
Expected behavior
On a file for which vint produces many warnings, I would expect to see hints about those warnings in the gutter
Desktop (please complete the following information):
Log:
I'm not sure how I can obtain logs.
As a concrete example, I'd like to change just the command
of linters.shellcheck
, but if I have the following in my coc config I end up with a useless config (without all the other necessary options in initializationOptions.linters.shellcheck
), also below.
{
"diagnostic-languageserver": {
"linters": {
"shellcheck": {
"command": "/nix/store/7zddzbmfv7sd7138ybw4h9ayqg4j7qib-shellcheck-0.7.1-bin/bin/shellcheck"
}
}
}
}
"initializationOptions": {
"linters": {
"shellcheck": {
"command": "/nix/store/7zddzbmfv7sd7138ybw4h9ayqg4j7qib-shellcheck-0.7.1-bin/bin/shellcheck"
},
...
I would expect that the default settings in initializationOptions.linters.shellcheck
would be preserved.
Relative part of init.nvim
call minpac#add('neoclide/coc.nvim', {'branch': 'release'})
call minpac#add('iamcco/coc-diagnostic', {'do': {-> system('yarn install --frozen-lockfile') }})
I get this error
[coc.nvim]extension "coc-diagnostic" doesn't contain main file /home/doc/.cache/vim/pack/minpac/start/coc-diagnostic/out/index.js
I went to the directory where coc-diagnostic has been installed and ran yarn install --frozen-lockfile
to verify it was installed correctly
yarn install v1.22.4
[1/5] Validating package.json...
warning [email protected]: The engine "coc" appears to be invalid.
[2/5] Resolving packages...
success Already up-to-date.
Done in 0.18s.
What should I do?
eslint v6.8.0
diagnostic handle fail: [eslint] Unexpected end of JSON input
My coc-settings.json
file looks like this
"diagnostic-languageserver.filetypes": {
"sh": "shellcheck"
}
But I want to pass -x
to shellcheck
, how do I do this? Is it possible?
I'm trying my best here to configure coc.nvim because it seems like a fantastic solution.. but unfortunately I feel as though the documentation is still a bit spotty. I'm trying to have coc-diagonstic work as the screenshot show in the readme.. where the popup shows the error.
Is there any way I can get the error to display in the popup? Right now mine only displays in the status line
Describe the bug
Now coc-nvim support one formatter at some time (neoclide/coc.nvim#2269).
I use "stylelintplus.autoFixOnSave: true" and with this variant coc-diagnostico wants start automatic on save.
It would not be bad to be able to run the coc-diagnostic formatter manually on save from .vimrc
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Log:
The details are not so clear to me.
I configured my coc-settings.json
like this:
{
...
"diagnostic-languageserver.filetypes": {
"sh": "shellcheck"
},
"diagnostic-languageserver.formatters": {
"tf": "terraform fmt",
"terraform": "terraform fmt"
},
"diagnostic-languageserver.formatFiletypes": {
"tf": "terraform fmt",
"terraform": "terraform fmt"
},
...
}
However, when opening a file that is recognized as terraform (:set filetype?
echoes filetype=terraform
), I don't understand how to format the file. I tried:
gggqG
it messes up the file.
gg=G
formats the file well, but not with the terraform fmt
which also aligns the equals (=
).
I tried also: <Plug>(coc-format)
which is mapped to a key, nothing happens.
What am I doing wrong? Thanks.
OS: Windows 10
Neovim:
In my coc-settings.json
:
"diagnostic-languageserver.filetypes": {
"html": "tidy",
"vim": "vint"
},
"diagnostic-languageserver.linters": {
"tidy": {
"command": "tidy",
"args": ["-e", "-q"],
"rootPatterns": [".git/"],
"debounce": 100,
"offsetLine": 0,
"offsetColumn": 0,
"sourceName": "tidy",
"formatLines": 1,
"formatPattern": [
"^.*(\\d+).*(\\d+)\\s+-\\s+([^:]+):\\s+(.*)$",
{
"line": 1,
"column": 2,
"endLine": 1,
"endColumn": 2,
"message": [4],
"security": 3
}
]
}
As for the pattern, here is an example output when I run tidy -e -q test.html
from terminal:
line 25 column 3 - Error: <dic> is not recognized!
But nothings happens while editing the file and an error is present.
Additionally, previously the formatPattern
was not configured in my coc-settings.json
file, and when I type :CocInfo
there are lines saying that:
## Output channel: diagnostic-languageserver
[Error - 9:15:03 PM] [html] diagnostic handle fail: [tidy] missing formatLines or formatPattern
So I think it is working in background, but nothing pops up after I configured formatPattern
.
Hi,
Thanks for taking the effort to make this wonderful plugin. I use it on professional and personal level on a day to day basis.
I'm stuck on trying to get cppcheck (https://github.com/danmar/cppcheck) hooked up as linter. It seems no output is received from cppcheck
.
When I run cppcheck
using
cppcheck --template='{line}:{column} {message} [{severity}]' --enable=all --inconclusive --quiet ./ftdi_spi.c
It results in the following output
1060:8 Variable 'status' is reassigned a value before the old one has been used. [style]
1102:16 Variable 'tempNode' is reassigned a value before the old one has been used. [style]
390:34 The scope of the variable 'CurrentXferSize' can be reduced. [style]
536:34 The scope of the variable 'CurrentXferSize' can be reduced. [style]
343:33 Function 'SPI_Read' argument 4 names different: declaration 'sizeTransfered' definition 'sizeTransferred'. [style]
343:57 Function 'SPI_Read' argument 5 names different: declaration 'options' definition 'transferOptions'. [style]
484:33 Function 'SPI_Write' argument 4 names different: declaration 'sizeTransfered' definition 'sizeTransferred'. [style]
484:57 Function 'SPI_Write' argument 5 names different: declaration 'options' definition 'transferOptions'. [style]
538:18 Local variable 'config' shadows outer variable [style]
1228:7 Unused variable: activeLow [style]
1233:11 Unused variable: value [style]
1233:18 Unused variable: oldValue [style]
1233:28 Unused variable: direction [style]
264:4 %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'. [warning]
441:3 %u in format string (no. 1) requires 'unsigned int' but the argument type is 'unsigned long'. [warning]
441:3 %u in format string (no. 2) requires 'unsigned int' but the argument type is 'unsigned long *'. [warning]
454:2 %u in format string (no. 1) requires 'unsigned int' but the argument type is 'unsigned long'. [warning]
454:2 %u in format string (no. 2) requires 'unsigned int' but the argument type is 'unsigned long'. [warning]
595:2 %u in format string (no. 1) requires 'unsigned int' but the argument type is 'unsigned long'. [warning]
595:2 %u in format string (no. 2) requires 'unsigned int' but the argument type is 'unsigned long'. [warning]
956:2 %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'. [warning]
963:33 %u in format string (no. 1) requires 'unsigned int' but the argument type is 'size_t {aka unsigned long}'. [portability]
983:33 %u in format string (no. 1) requires 'unsigned int' but the argument type is 'size_t {aka unsigned long}'. [portability]
1042:6 %x in format string (no. 1) requires 'unsigned int' but the argument type is 'ChannelContext_t *'. [warning]
1047:6 %x in format string (no. 1) requires 'unsigned int' but the argument type is 'ChannelContext_t *'. [warning]
1052:6 %x in format string (no. 1) requires 'unsigned int' but the argument type is 'ChannelContext_t *'. [warning]
1109:5 %x in format string (no. 2) requires 'unsigned int' but the argument type is 'ChannelConfig_t *'. [warning]
1109:5 %x in format string (no. 3) requires 'unsigned int' but the argument type is 'size_t {aka unsigned long}'. [portability]
1020:18 Unused variable: tempNode [style]
873:0 The function 'SPI_ChangeCS' is never used. [style]
285:0 The function 'SPI_CloseChannel' is never used. [style]
138:0 The function 'SPI_GetChannelInfo' is never used. [style]
109:0 The function 'SPI_GetNumChannels' is never used. [style]
197:0 The function 'SPI_InitChannel' is never used. [style]
817:0 The function 'SPI_IsBusy' is never used. [style]
164:0 The function 'SPI_OpenChannel' is never used. [style]
342:0 The function 'SPI_Read' is never used. [style]
627:0 The function 'SPI_ReadWrite' is never used. [style]
483:0 The function 'SPI_Write' is never used. [style]
0:0 Cppcheck cannot find all the include files (use --check-config for details) [information]
But in vim no output from cppcheck
is shown at any of these lines.
Regular expression test at https://regexr.com/5ik2v.
CocInfo
CocInfo.log
CocCommand workspace.showOutput
workspace.showOutput.log
CocConfig
CocConfig.log
Thanks in advance.
How do I start any formatter. for example eslint --fix, which command to use? Can it be set to run automatically when file saved?
Hello, I have tested this extension with the shellcheck
example and it worked well.
However, I'm trying to configure Standard with no success.
Here is my configuration for coc-diagnostic
:
// ...
"diagnostic-languageserver.formatters": {
"standard": {
"command": "./node_modules/.bin/standard",
"args": ["--stdin", "--fix"],
"rootPatterns": [".git"],
"isStderr": true,
"isStdout": false
}
},
"diagnostic-languageserver.linters": {
"standard": {
"command": "./node_modules/.bin/standard",
"isStderr": true,
"isStdout": false,
"args": ["--stdin", "--verbose"],
"rootPatterns": [".git"],
"debounce": 100,
"offsetLine": 0,
"offsetColumn": 0,
"sourceName": "standard",
"formatLines": 1,
"formatPattern": [
"^\\s*<\\w+>:(\\d+):(\\d+):\\s+(.*)$",
{
"line": 1,
"column": 2,
"message": 3
}
]
}
},
"diagnostic-languageserver.filetypes": {
"javascript": "standard",
"javascript.jsx": "standard"
},
"diagnostic-languageserver.formatFiletypes": {
"javascript": "standard",
"javascript.jsx": "standard"
},
// ...
I get no errors and no fixes on write with this config. I have tested the regex and it matches with messages output in stderr by Standard. Am I missing something?
This extension overrides currently watched location list. It annoys when watching some manually created list so I have set "diagnostic.locationlist": false
.
However in some cases the possibility of manual populating the list would be useful.
Please create an action that triggers populating the list one time.
When installing using vim-plug
, e.g.:
Plug 'iamcco/coc-diagnostic', {'do': 'yarn install --frozen-lockfile'}
Error:
[coc.nvim] extension "coc-diagnostic" doesn't contain main file /Users/xxx/.vim
/plugged/coc-diagnostic/out/index.js.
Nothing happen then i open style.css file with "div, .test { border: 1px solid red }
" content.
Here 's how I got the test line:
cat style.css | npx stylelint -f compact
Here 's how I got the regexp:
const line = '<input css 1>: line 1, col 37, error - Expected newline before "}" (block-closing-brace-newline-before)';
const formatPattern = "^[^:]+:\\D+(\\d+)\\D+(\\d+)\\W+(\\w+)\\s-\\s(.*)$";
const match = line.match(new RegExp(formatPattern));
console.log(match);
My not working config:
{
"diagnostic-languageserver.trace.server": "verbose",
"diagnostic-languageserver.filetypes": {
"css": "stylelint"
},
"diagnostic-languageserver.linters": {
"stylelint": {
"command": "./node_modules/.bin/stylelint",
"rootPatterns": [".git"],
"debounce": 100,
"args": ["-f compact"],
"offsetLine": 0,
"offsetColumn": 0,
"sourceName": "stylelint",
"isStderr": false,
"isStdout": true,
"formatLines": 1,
"formatPattern": [
"^[^:]+:\\D+(\\d+)\\D+(\\d+)\\W+(\\w+)\\s-\\s(.*)$",
{
"line": 1,
"column": 2,
"message": 4,
"security": 3
}
],
"securities": {
"error": "error",
"warning": "warning"
}
}
}
}
cocinfo:
## versions
vim version: NVIM v0.5.0-dev
node version: v12.10.0
coc.nvim version: 0.0.74-741de710b6
term: screen-256color
platform: linux
## Messages
## Output channel: diagnostic-languageserver
[Trace - 2:32:57 PM] Sending request 'initialize - (0)'.
Params: {
"processId": 27675,
"rootPath": "/home/devpa/Projects/test",
"rootUri": "file:///home/devpa/Projects/test",
"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
]
}
},
"executeCommand": {
"dynamicRegistration": true
},
"configuration": true,
"workspaceFolders": true
},
"textDocument": {
"publishDiagnostics": {
"relatedInformation": true
},
"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
]
}
},
"codeAction": {
"dynamicRegistration": 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
},
"typeDefinition": {
"dynamicRegistration": true
},
"implementation": {
"dynamicRegistration": true
},
"declaration": {
"dynamicRegistration": true
},
"colorProvider": {
"dynamicRegistration": true
},
"foldingRange": {
"dynamicRegistration": true,
"rangeLimit": 5000,
"lineFoldingOnly": true
}
}
},
"initializationOptions": {
"linters": {
"eslint": {
"command": "./node_modules/.bin/eslint",
"rootPatterns": [
".git"
],
"debounce": 100,
"args": [
"--stdin",
"--no-color"
],
"offsetLine": 0,
"offsetColumn": 0,
"sourceName": "eslint",
"formatLines": 1,
"formatPattern": [
"^\\s*(\\d+):(\\d+)\\s+([^ ]+)\\s+(.*?)\\s+([^ ]+)$",
{
"line": 1,
"column": 2,
"message": [
4,
" [",
5,
"]"
],
"security": 3
}
],
"securities": {
"error": "error",
"warning": "warning"
}
},
"shellcheck": {
"command": "shellcheck",
"debounce": 100,
"args": [
"--format=gcc",
"-"
],
"offsetLine": 0,
"offsetColumn": 0,
"sourceName": "shellcheck",
"formatLines": 1,
"formatPattern": [
"^[^:]+:(\\d+):(\\d+):\\s+([^:]+):\\s+(.*)$",
{
"line": 1,
"column": 2,
"message": 4,
"security": 3
}
],
"securities": {
"error": "error",
"warning": "warning",
"note": "info"
}
},
"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*(.*$)",
{
"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+(.*)$",
{
"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+(.*)$",
{
"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+(.*)$",
{
"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+(.*)$",
{
"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+(.*)$",
{
"line": -1,
"column": -1,
"message": [
"[",
2,
"]: ",
3,
": ",
5
],
"security": 1
}
],
"securities": {
"**": "error"
}
},
"stylelint": {
"command": "./node_modules/.bin/stylelint",
"rootPatterns": [
".git"
],
"debounce": 100,
"args": [
"-f compact"
],
"offsetLine": 0,
"offsetColumn": 0,
"sourceName": "stylelint",
"isStderr": true,
"isStdout": true,
"formatLines": 1,
"formatPattern": [
"^[^:]+:\\D+(\\d+)\\D+(\\d+)\\W+(\\w+)\\s-\\s(.*)$",
{
"line": 1,
"column": 2,
"message": 4,
"security": 3
}
],
"securities": {
"error": "error",
"warning": "warning"
}
}
},
"filetypes": {
"css": "stylelint"
},
"formatters": {
"dartfmt": {
"command": "dartfmt",
"args": [
"--fix"
]
},
"mix_format": {
"command": "mix",
"args": [
"format",
"-"
]
}
},
"formatFiletypes": {}
},
"trace": "verbose",
"workspaceFolders": [
{
"uri": "file:///home/user/Projects/test",
"name": "test"
}
]
}
[Trace - 2:32:57 PM] Received response 'initialize - (0)' in 207ms.
Result: {
"capabilities": {
"textDocumentSync": 1,
"documentFormattingProvider": true
}
}
[Trace - 2:32:57 PM] Sending notification 'initialized'.
Params: {}
[Trace - 2:32:57 PM] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///home/user/Projects/test/style.css",
"languageId": "css",
"version": 1,
"text": "div, .test { border: 1px solid red }\n"
}
}
[Trace - 2:32:58 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///home/user/Projects/test/style.css",
"diagnostics": []
}
## Output channel: highlight
[Info - 2:32:57 PM] Highlight server running in node v12.10.0
@iamcco - With the mix_credo
linter (thanks for making that one official!), the gutter signs i set for diagnostics in coc-settings.json
show up, then disappear a second or so later..
Confirmed that elixir-ls
diagnostics and their gutter signs work and stay in place.
This description seems to be wrong. Also in README.md.
Lines 33 to 36 in ada0b10
Describe the bug
Not been able to get format on save working using the docs.
Error message: [coc.nvim] Will save handler timeout after 0.5s
To Reproduce
Relevant config:
"coc.preferences.formatOnSaveFiletypes": [
"ruby"
],
"diagnostic.enable": true,
"diagnostic-languageserver.formatFiletypes": {
"ruby": "rubocop"
},
"diagnostic-languageserver.formatters": {
"rubocop": {
"command": "bundle",
"args": [
"exec",
"rubocop",
"--auto-correct",
"--stdin",
"%filepath"
],
"isStderr": false,
"isStdout": true
}
},
Don't think coc.preferences.formatOnSaveFileTypes
is mentioned in docs, not sure it's needed.
Expected behavior
Formatted on write.
Desktop (please complete the following information):
Log:
2021-02-25T18:27:11.091 INFO (pid:5521) [services] - registered service "diagnostic-languageserver"
2021-02-25T18:27:11.107 INFO (pid:5521) [services] - registered service "highlight"
2021-02-25T18:27:11.145 WARN (pid:5521) [attach] - Plugin not ready when received "highlight" []
2021-02-25T18:27:11.168 INFO (pid:5521) [language-client-index] - highlight started with 5921
2021-02-25T18:27:11.177 INFO (pid:5521) [plugin] - coc.nvim 0.0.80-8cfed3b159 initialized with node: v14.2.0 after 160ms
2021-02-25T18:27:12.510 INFO (pid:5521) [attach] - receive notification: highlight []
2021-02-25T18:27:12.520 INFO (pid:5521) [services] - diagnostic language service state change: stopped => starting
2021-02-25T18:27:12.589 INFO (pid:5521) [services] - registered service "solargraph"
2021-02-25T18:27:12.593 INFO (pid:5521) [language-client-index] - diagnostic-languageserver started with 6074
2021-02-25T18:27:12.681 INFO (pid:5521) [services] - diagnostic language service state change: starting => running
2021-02-25T18:27:12.682 INFO (pid:5521) [services] - service diagnostic-languageserver started
2021-02-25T18:27:13.565 INFO (pid:5521) [attach] - receive request: CocAutocmd [ 'BufWritePre', 3 ]
2021-02-25T18:27:17.420 INFO (pid:5521) [attach] - receive notification: openLog []
I set up coc-diagnostic
with the python formatters black
and isort
. isort
works but black
does not seem to be invoked by :call CocAction("format")
.
nvim/coc setup
NVIM v0.4.4
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/cc -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim/src/build/config -I/build/neovim/src/neovim-0.4.4/src -I/usr/include -I/build/neovim/src/build/src/nvim/auto -I/build/neovim/src/build/include
Compiled by builduser
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
init.vim
if &compatible
set nocompatible
endif
filetype plugin indent on
call plug#begin('~/.config/nvim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()
black: version 20.8b1
isort: 5.7.0
coc-plugins: coc-jedi, coc-diagnostic, coc-json
coc-settings.json
{
"jedi.enable": true,
"jedi.startupMessage": false,
"jedi.markupKindPreferred": "plaintext",
"jedi.trace.server": "off",
"jedi.jediSettings.autoImportModules": [],
"jedi.executable.command": "jedi-language-server",
"jedi.executable.args": [],
"jedi.completion.disableSnippets": false,
"jedi.completion.resolveEagerly": false,
"jedi.diagnostics.enable": true,
"jedi.diagnostics.didOpen": true,
"jedi.diagnostics.didChange": true,
"jedi.diagnostics.didSave": true,
"jedi.workspace.extraPaths": [],
"diagnostic-languageserver.filetypes": {
"python": "flake8",
"cpp": "cpplint",
"sh": "shellcheck"
},
"diagnostic-languageserver.formatFiletypes": {
"sh": "shfmt",
"python": ["black", "isort"]
},
"diagnostic-languageserver.formatters": {
"black": {
"command": "black",
"args": ["--quiet", "--line-length 80", "-"]
},
"isort": {
"command": "isort",
"args": ["--quiet", "-"]
}
},
"diagnostic.checkCurrentLine": true,
"diagnostic.virtualText": false,
"diagnostic.displayByAle": false
}
:CocInfo after calling :call CocAction("format")
in MWE below
vim version: NVIM v0.4.4
node version: v15.8.0
coc.nvim version: 0.0.80-6e5a2aaeb5
coc.nvim directory: /home/david/.config/nvim/plugged/coc.nvim
term: xterm-256color
platform: linux
## Log of coc.nvim
2021-02-17T13:58:21.771 INFO (pid:469777) [services] - registered service "diagnostic-languageserver"
2021-02-17T13:58:21.773 INFO (pid:469777) [services] - diagnostic language service state change: stopped => starting
2021-02-17T13:58:21.782 INFO (pid:469777) [services] - registered service "jedi"
2021-02-17T13:58:21.782 INFO (pid:469777) [services] - jedi-language-server state change: stopped => starting
2021-02-17T13:58:21.784 INFO (pid:469777) [plugin] - coc.nvim 0.0.80-6e5a2aaeb5 initialized with node: v15.8.0 after 107ms
2021-02-17T13:58:21.792 INFO (pid:469777) [language-client-index] - diagnostic-languageserver started with 469790
2021-02-17T13:58:21.804 INFO (pid:469777) [language-client-index] - Language server "jedi" started with 469796
2021-02-17T13:58:21.952 INFO (pid:469777) [services] - diagnostic language service state change: starting => running
2021-02-17T13:58:21.957 INFO (pid:469777) [services] - service diagnostic-languageserver started
2021-02-17T13:58:21.994 INFO (pid:469777) [services] - jedi-language-server state change: starting => running
2021-02-17T13:58:22.001 INFO (pid:469777) [services] - service jedi started
2021-02-17T13:58:30.042 INFO (pid:469777) [attach] - receive notification: showInfo []
2021-02-17T13:58:30.064 INFO (pid:469777) [attach] - receive request: CocAutocmd [ 'BufReadCmd', 'output', 'output:///info' ]
2021-02-17T13:58:38.049 INFO (pid:469777) [attach] - receive request: format []
2021-02-17T13:58:45.450 INFO (pid:469777) [attach] - receive notification: showInfo []
MWE:
import scipy.interpolate as si
import numpy as np
x = 'hello'
isort
reorders the imports, black
should change the single quotes to double quotes. However, :call CocAction("format")
produces:
import numpy as np
import scipy.interpolate as si
x = 'hello'
I.e., the black
formatting is ignored (see :CocInfo
above).
Any advice is appreciated! And thank you for your work.
"Empty diagnostics" for GraphQL files when using gqlint. Why does coc-diagnostic not capture the below warnings from the linter?
"diagnostic-languageserver.linters": {
"gqlint": {
"command": "gqlint",
"debounce": 100,
"offsetLine": 3,
"offsetColumn": 1,
"sourceName": "gqlint",
"formatLines": 1,
"formatPattern": [
"^\\s+(\\d+):(\\d+)\\s+(\\w+)\\s+(\\w+)\\s+(.+)$",
{
"line": 1,
"column": 2,
"endLine": 1,
"endColumn": 2,
"message": 5,
"security": 3
}
],
"securities": {
"error": "error",
"warning": "warning",
"note": "info"
}
}
},
"diagnostic-languageserver.filetypes": {
"graphql": "gqlint"
},
"diagnostic-languageserver.formatFiletypes": {
"dart": "dartfmt"
},
...
I tried to install this extension like:
Plug 'iamcco/coc-diagnostic', {'do': 'yarn install --frozen-lockfile'}
Installation itself is succeeded but linting/formatting didn't work. I confirmed the extension is activated on CocList extensions
. So, when I executed :CocInstall coc-diagnostic
, the features started to work properly.
How do I install this plugin to work properly?
Thank you for developing this awesome plugin.
It's not clear to me what exactly needs to be to be done to add a new linter.
The README redirects here for instructions telling me I need to add a new language server in CoC for this. Why? doesn't coc-diagnostic already contain an LSP?
I'll use markdownlint as an example.
So I edit coc-settins.json
adding the following:
// ...
"languageserver": {
"dls": {
"command": "diagnostic-languageserver",
"args": ["--stdio"],
"filetypes": [ "markdown" ],
"initializationOptions": {
"linters": {
"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
}
]
}
},
"filetypes": {
"markdown": "markdownlint"
}
}
}
}
// ...
But CoC fails telling me it cannot run this language server:
## versions
vim version: NVIM v0.4.4
node version: v15.5.0
coc.nvim version: 0.0.80-cf0e8400a4
coc.nvim directory: /home/ignacio/.local/share/nvim/plugged/coc.nvim
term: xterm-256color
platform: linux
## Log of coc.nvim
2021-01-02T14:55:25.532 INFO (pid:8196) [services] - registered service "languageserver.dls"
2021-01-02T14:55:25.535 INFO (pid:8196) [services] - dls state change: stopped => starting
2021-01-02T14:55:25.549 INFO (pid:8196) [services] - registered service "diagnostic-languageserver"
2021-01-02T14:55:25.549 INFO (pid:8196) [services] - diagnostic language service state change: stopped => starting
2021-01-02T14:55:25.704 INFO (pid:8196) [services] - registered service "jedi"
2021-01-02T14:55:25.706 INFO (pid:8196) [plugin] - coc.nvim 0.0.80-cf0e8400a4 initialized with node: v15.5.0 after 223ms
2021-01-02T14:55:25.710 INFO (pid:8196) [services] - dls state change: starting => stopped
2021-01-02T14:55:25.724 ERROR (pid:8196) [services] - Server languageserver.dls failed to start: Launching server "languageserver.dls" using command diagnostic-languageserver failed.
2021-01-02T14:55:25.724 ERROR (pid:8196) [language-client-index] - Error: spawn diagnostic-languageserver ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:276:19)
at onErrorNT (node:internal/child_process:476:16)
at processTicksAndRejections (node:internal/process/task_queues:80:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn diagnostic-languageserver',
path: 'diagnostic-languageserver',
spawnargs: [ '--stdio' ]
}
2021-01-02T14:55:25.730 INFO (pid:8196) [language-client-index] - diagnostic-languageserver started with 8209
2021-01-02T14:55:25.817 INFO (pid:8196) [services] - diagnostic language service state change: starting => running
2021-01-02T14:55:25.819 INFO (pid:8196) [services] - service diagnostic-languageserver started
2021-01-02T14:55:27.424 INFO (pid:8196) [attach] - receive notification: highlight []
2021-01-02T14:55:33.071 INFO (pid:8196) [attach] - receive notification: showInfo []
It seems that the command diagnostic-languageserver
is not in CoC search path, obvioulsy it's not under the PATH
environment variable since CoC installs its tools independently.
So, what I'm doing wrong?
Is there anyway the documentation can be improved? I'll be glad to help.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.