efm-langserver
efm-langserver copied to clipboard
Strange Vimwiki markdown Error with efm formatting in neovim
Hello!
This is a report for bug with vimwiki using efm.
I am using nvim with efm-langserver with native lsp.
I was setting up linting with markdownlint-cli installed using npm with efm but the linter was not working. I checked the output in ~/cache/nvim/lsp.log
just to be clear what was going wrong.
.cache/nvim/lsp.log
[ START ] 2021-06-07T01:17:20+0500 ] LSP logging initiated
[ START ] 2021-06-07T01:17:29+0500 ] LSP logging initiated
[ ERROR ] 2021-06-07T01:17:30+0500 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:457 ] "rpc" "efm-langserver" "stderr" "2021/06/07 01:17:30 efm-langserver: no configuration file\n2021/06/07 01:17:30 efm-langserver: reading on stdin, writing on stdout\n"
[ ERROR ] 2021-06-07T01:17:30+0500 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:457 ] "rpc" "efm-langserver" "stderr" '2021/06/07 01:17:30 jsonrpc2 handler: notification "workspace/didChangeConfiguration" handling error: json: cannot unmarshal bool into Go struct field Config.settings.languages of type langserver.Language\n'
[ ERROR ] 2021-06-07T01:17:30+0500 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:457 ] "rpc" "efm-langserver" "stderr" "2021/06/07 01:17:30 lint for LanguageID not supported: vimwiki\n"
It seems like it was not picking up my markdown files even though I had mentioned it in the config. It was showing vimwiki in the error of linting not supported instead of markdown which is a plugin. I uninstalled vimwiki and it worked.I checked the logs again and it picked it up properly this time and showed markdown instead of vimwiki.
lsp.log
[ ERROR ] 2021-06-07T01:32:32+0500 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:457 ] "rpc" "efm-langserver" "stderr" '2021/06/07 01:32:32 jsonrpc2 handler: notification "workspace/didChangeConfiguration" handling error: json: cannot unmarshal bool into Go struct field Config.settings.languages of type langserver.Language\n'
[ ERROR ] 2021-06-07T01:32:32+0500 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:457 ] "rpc" "efm-langserver" "stderr" "2021/06/07 01:32:32 lint for LanguageID not supported: markdown\n"
System Settings:
Arch linux
0.5 nightly build
npm version 7.16.0
:VimwikiShowVersion
Stable version: 2.5
Steps to Reproduce Error:
- Install vimwiki
paq 'vimwiki/vimwiki'
in neovim-nightly. - Install markdownlint-cli with
npm install -g markdownlint-cli
. - Setup efm with lsp and try to format the output with lsp format key binding (I have set it to format on autosave).
- Open a .md file and log the output when you press the format keybinding and you will see the error about vimwiki.
- Uninstall it and it will return back to normal as the second log.
efm.lua
local on_attach = function(client)
if client.resolved_capabilities.document_formatting then
vim.api.nvim_command [[augroup Format]]
vim.api.nvim_command [[autocmd! * <buffer>]]
vim.api.nvim_command [[autocmd BufWritePost <buffer> lua vim.lsp.buf.formatting()]]
vim.api.nvim_command [[augroup END]]
end
end
local eslint = require "efm/eslint"
local isort = require "efm/isort"
local flake8 = require "efm/flake"
local luafmt = require "efm/luafmt"
local shfmt = require "efm/shfmt"
local vint = require "efm/vint"
local prettier = require "efm/prettier"
--local markdownPandocFormat = require"efm/pandoc"
local markdownlint = require"efm/markdownlint"
local shellcheck = require"efm/shellcheck"
require"lspconfig".efm.setup {
on_attach = on_attach,
init_options = {documentFormatting = true},
rootdir = vim.loop.cwd,
filetypes = {
"lua", "python", "sh", "html", "css", "javascript", "json", "javascriptreact", "markdown",
"graphql", "scss", "yaml", "javascript.jsx", "typescript", "typescript.tsx",
"typescriptreact", "vim"
},
settings = {
rootMarkers = {".git/"},
languages = {
sh = {shfmt, shellcheck},
vim = {vint},
lua = {luafmt},
markdown = {markdownlint},
python = {flake8, isort},
javascript = {prettier, eslint},
javascriptreact = {prettier, eslint},
["javascript.jsx"] = {prettier, eslint},
typescript = {prettier, eslint},
["typescript.tsx"] = {prettier, eslint},
typescriptreact = {prettier, eslint},
--pandoc = {markdownlint},
--html = {formatCommand="prettier ${--tab-width:tabWidth} ${--single-quote:singleQuote} --parser html",formatStdin=true},
css = {prettier},
scss = {prettier},
yaml = {prettier},
json = {prettier, eslint}
}
}
}
markdownlint.lua
return {
lintCommand = 'markdownlint -s',
lintStdin = true,
lintFormats = {'%f:%l %m', '%f:%l:%c %m', '%f: %l: %m'}
}
Sorry I messed it up the first time
Were you managed to solve the issue? i think i am having the same issue as well, #158