noice.nvim
noice.nvim copied to clipboard
bug: todo-comments causes false error notifications
Did you check docs and existing issues?
- [X] I have read all the noice.nvim docs
- [X] I have searched the existing issues of noice.nvim
- [X] I have searched the exsiting issues of plugins related to this issue
Neovim version (nvim -v)
0.8.1
Operating system/version
Ubuntu 18.04.6
Describe the bug
When todo-comments is installed, the first notification sent after writing a file is always an error. This doesn't happen without todo-comments installed, and it doesn't happen if todo-comments is installed but noice isn't.
As a side note, the prefilled repro.lua given in the issue template is different from the wiki, and is missing the dependencies.
Steps To Reproduce
- Save the
repro.lua
below and open it withnvim -u repro.lua repro.lua
. - Write the file with
:w
. - Press
d10d
to delete 10 lines and thenu
to bring them back, giving notifications that are marked as messages. - Press
:w
to write the buffer. - Repeat step 3, noticing that the notification is now marked as an error.
- Repeating step 3 again without writing, the notifications are again marked as messages.
- Remove todo-comments from
repro.lua
and repeat the above, the issue will disappear.
Expected Behavior
I'd expect notifications to behave as they do normally, such as if todo-comments is removed from the repro.lua
below.
Repro
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
{
"folke/noice.nvim",
dependencies = {
"MunifTanjim/nui.nvim",
"rcarriga/nvim-notify",
},
},
{
"folke/todo-comments.nvim",
config = function()
require("todo-comments").setup()
end,
},
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
-- add anything else here
vim.opt.termguicolors = true
vim.cmd([[colorscheme tokyonight]])
require("noice").setup()
was just about opening an issue for this before i saw yours and it helped me figure out the problem i have been trying to solve. i get the same error message whenever i write into the same file for the second time. The error message is identical to the message you get whenever you write into a file. i just disabled todo and the error disappeared.
I'm getting the same error
Met the same issue. The first notification will always be "ERROR", but actually the notification should be "INFO".
I'm getting the same error local opts = { noremap = true, -- non-recursive silent = true, -- do not show message } vim.keymap.set('n', "S", ':w<CR>', opts)
But I changed the write file mapping as follows and got the solution
vim.keymap.set('n', "S", ':w<CR>') But every time the shortcut key is written to a file, the cmd command will flash, which is not perfect.