Open horseinthesky opened 3 years ago
Can you provide what error-line was outputted?
@mattn
Client 2 quit with exit code 2 and signal 0
is the only info i get.
Even if I put logging setting to the setup:
local languages = {
python = { isort, flake8, black, mypy },
lua = { stylua },
yaml = { prettier },
json = { prettier },
html = { prettier },
css = { prettier },
markdown = { prettier },
}
lspconfig.efm.setup {
filetypes = vim.tbl_keys(languages),
init_options = {
documentFormatting = true,
},
settings = {
languages = languages,
log_level = 1,
log_file = vim.fn.expand("~/.config/efm-langserver/efm.log"),
},
}
~/.config/efm-langserver
dir is empty.
What do you get with
flake8 --ignore=E501,W503 --stdin-display-name your-source-code.js - < your-source-code.js
What do you get with
flake8 --ignore=E501,W503 --stdin-display-name your-source-code.js - < your-source-code.js
As expected I get my error from screenshot
flake8 --ignore=E501,W503 --stdin-display-name mondata/juggler_cloud/bgp.py - < mondata/juggler_cloud/bgp.py
mondata/juggler_cloud/bgp.py:7:1: F401 'a_nasty_path_hack' imported but unused
I am not able to test this at the moment but I think you are missing category in the format string.
%f:%l:%c: %m
would be file:line:col: message
but you want category in there which needs to be a single character due to the use of errorformat which implements the quickfix format.
You could try %f:%l:%c: %t%n %m
the %t
consumes the first character of F401 from your example as category and %n
consumes the number. Afterwards %m
consumes the rest of the text as message.
@atrautsch Thanks a lot.
%f:%l:%c: %m
has this output
%f:%l:%c: %t%n %m
has this
That is cool it uses category now but now it doesn't show the code (which was shown with the original format). Also is it possible to print linters name?
I do not quite understand how this works but using different combinations from here breaks the diagnostics in most cases :P
%f:%l:%c: %m
and %f:%l:%c: %t%n %m
are basically speaking the only options which work.
The idea is that the line mondata/juggler_cloud/bgp.py:7:1: F401 'a_nasty_path_hack' imported but unused
is completely consumed by the format string. %f
consumes the path and filename, %l
the line and so on.
That is why no other format works and also why the code is not shown.
Only the part that is consumed by %m
is shown and the code is already consumed by %t
and %c
.
I am not sure if it is possible to show the code. It may require a change to efm-langserver which allows formatting the string returned to the LSP client so that it could include parts of the errorformat again.
The linters name should be possible with using lintSource or prefix in the configuration.
lintStdin = true,
prefix = "flake8",
lintSource = "flake8"
@atrautsch
linkSource
doesn't seem to have any effect. Also, it is not mentioned in the schema
https://github.com/mattn/efm-langserver/blob/cf157c6d2c81c877426338b4ac1b109f5516ca5d/schema.json#L34-L129
prefix
does work though. Thank you.
Would be great to keep error code but if it is not possible at the moment I am ready to close the issue.
@mattn Do you have anything to add?
Still I don't understand what is wrong. Hmm.
Just wondering if it is possible to set efm to show error codes like this
Hello.
I cannot figure out how to setup categories for
flake8
linter.I have the following config:
I've tried to add
block but whatever format I use it leads to
Client 2 quit with exit code 2 and signal 0
And also if it is possible to print linter name in Neovim virtual text besides code and message?