Diagnostics are not updated when you open the file directly from cli #367
-
Hi! I have a very strange bug, but didn't wanted to create an issue yet in case I'm doing something obviously wrong. I have configured some linters (eslint, shellcheck, etc...) When I open the file with telescope or dirvish when I'm already inside Neovim, the diagnostics update without a problem when editing the buffer (super fast I must say! coming from diagnosticls) But, if I open the file directly from the cli, the initial diagnostics get loaded, but edits to the buffer doesn't appear to update the diagnostics. Hopefully this video can give you some more context. Notice in my statusline how the diagnostics get (or doesn't get) updated (I'm calling 2021-11-19_null-ls.mp4My config is nothing outside of the ordinary (the relevant parts, let me know if you need more context): require('packer').startup(function(use)
use({
'jose-elias-alvarez/null-ls.nvim',
requires = { 'nvim-lua/plenary.nvim', 'neovim/nvim-lspconfig' },
})
end)
local null_ls = require('null-ls')
null_ls.config({
debug = true,
-- you must define at least one source for the plugin to work
sources = {
null_ls.builtins.formatting.stylua.with({
extra_args = { '--config-path', vim.fn.expand('~/.config/stylua.toml') },
}),
null_ls.builtins.diagnostics.shellcheck,
null_ls.builtins.diagnostics.markdownlint.with({
extra_args = { '--config', vim.fn.expand('~/Sync/notes/.markdownlintrc') },
}),
null_ls.builtins.diagnostics.eslint.with({
only_local = 'node_modules/.bin/',
}),
},
})
require('lspconfig')['null-ls'].setup({
-- see the nvim-lspconfig documentation for available configuration options
on_attach = on_attach,
}) I'm attaching the logs for the good and the bad sessions: Am I the only one with this bug!? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
This is definitely unusual and I was unable to replicate the bug with your config. Looking at your logs, it seems that the |
Beta Was this translation helpful? Give feedback.
-
Yes, let me show you in a video below
Yes, also tested with I investigated a little more and found a way to replicate the error. Still cannot comprehend why is happening though. TLDR: With Neovim version: λ nvim -v
NVIM v0.6.0-dev+622-gfd6df7481
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by neuromante Minimal init.lua: require('packer').startup(function(use)
use('wbthomason/packer.nvim')
use({
'jose-elias-alvarez/null-ls.nvim',
requires = { 'nvim-lua/plenary.nvim', 'neovim/nvim-lspconfig' },
})
use({
'clojure-vim/clojure.vim',
cond = function()
return true
end,
})
end)
local null_ls = require('null-ls')
null_ls.config({
debug = true,
sources = {
null_ls.builtins.formatting.stylua.with({
extra_args = { '--config-path', vim.fn.expand('~/.config/stylua.toml') },
}),
null_ls.builtins.diagnostics.shellcheck,
null_ls.builtins.diagnostics.markdownlint.with({
extra_args = { '--config', vim.fn.expand('~/Sync/notes/.markdownlintrc') },
}),
null_ls.builtins.diagnostics.eslint.with({
only_local = 'node_modules/.bin/',
}),
},
})
require('lspconfig')['null-ls'].setup({
on_attach = function(client, bufnr)
if client.resolved_capabilities.document_formatting then
vim.cmd('autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()')
end
end,
}) The key thing is the use({
'clojure-vim/clojure.vim',
cond = function()
return true
end,
}) See: 2021-11-22_null-ls.mp4My understanding is that λ diffoscope packer_compiled.lua.good.txt packer_compiled.lua.bad.txt
--- packer_compiled.lua.good.txt
+++ packer_compiled.lua.bad.txt
@@ -66,15 +66,15 @@
return result
end
time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
["clojure.vim"] = {
- cond = { "\27LJ\2\n\15\0\0\1\0\0\0\2+\0\1\0L\0\2\0\0" },
+ cond = { "\27LJ\2\n\15\0\0\1\0\0\0\2+\0\2\0L\0\2\0\0" },
loaded = false,
needs_bufread = true,
only_cond = true,
path = "/home/neuromante/.local/share/nvim/site/pack/packer/opt/clojure.vim",
url = "https://github.com/clojure-vim/clojure.vim"
},
["null-ls.nvim"] = { I even changed manually that magic string and it works: 2021-11-22_null-ls-2.mp4Man, this is way out of my understanding. The weird thing is that only happens with diagnostics generated by |
Beta Was this translation helpful? Give feedback.
This is definitely unusual and I was unable to replicate the bug with your config. Looking at your logs, it seems that the
eslint
output itself is not updated after changing the file. Does everything work as expected when you runeslint
directly from the command line? Also, do you see this same issue with your other diagnostic sources?