Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: messages printed during start up are missing #799

Closed
3 tasks done
adoyle-h opened this issue May 14, 2024 · 2 comments · Fixed by #801
Closed
3 tasks done

bug: messages printed during start up are missing #799

adoyle-h opened this issue May 14, 2024 · 2 comments · Fixed by #801
Labels
bug Something isn't working

Comments

@adoyle-h
Copy link
Contributor

Did you check docs and existing issues?

  • I have read all the noice.nvim docs
  • I have searched the existing issues of noice.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

v0.9.5

Operating system/version

MacOS 14.1.2 (23B2091)

Describe the bug

The messages printed by vim.print and vim.notify during start up are missing in Noice message window and Noice history window.

For common scenario, some plugins may print warning messages during start up. User will not see these messages and :Noice history also miss them.

Steps To Reproduce

  1. nvim -u ./repro.lua
  2. :messages to view the "warning" and "hello" messages.
  3. :Noice history to view the messages in Noice window. And it is empty.

Expected Behavior

Show the "warning" and "hello" messages in Noice message window. And :Noice history includes these message.

Repro

-- DO NOT change the paths and don't remove the colorscheme
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", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

vim.cmd.color 'elflord'

local plugins = {
	{
		"folke/noice.nvim",
		-- event = "VeryLazy",
		dependencies = {
			"MunifTanjim/nui.nvim",
			"rcarriga/nvim-notify",
		},
		config = function()
			require("noice").setup({
				presets = {
					bottom_search = true, -- use a classic bottom cmdline for search
					command_palette = true, -- position the cmdline and popupmenu together
					long_message_to_split = true, -- long messages will be sent to a split
					inc_rename = false, -- enables an input dialog for inc-rename.nvim
					lsp_doc_border = false, -- add a border to hover docs and signature help
				},
			})
		end
	},

	{
		'ryanoasis/vim-devicons',
		config = function()
			vim.print('warning')
		end
	}
}

require("lazy").setup(plugins, {
	root = root .. "/plugins",
})


vim.print "hello"
@adoyle-h adoyle-h added the bug Something isn't working label May 14, 2024
@theKnightsOfRohan
Copy link

theKnightsOfRohan commented May 14, 2024

I'm pretty sure this doesn't have anything to do with Noice itself, but rather with the order that lazy.nvim loads plugins. If noice is loaded after the messages are printed, then it wouldn't register the messages and add it to its own logs. If you want to see any possible startup errors, then making the plugins with those possible errors have event = "VeryLazy" should be enough, so they load after Noice does.

@adoyle-h
Copy link
Contributor Author

adoyle-h commented May 14, 2024

It is not good for me to set event = "VeryLazy" to every plugin. Not all plugins really need to be VeryLazy. And I cannot predict which plugin would have startup error.

I think Noice should read the lines from :messages when it start and put these messages to its history.

@folke folke closed this as completed in 61947de May 15, 2024
adoyle-h added a commit to adoyle-h/noice.nvim that referenced this issue May 15, 2024
* up/main:
  fix(messages): include any messages before Noice was started as one history_show message. Fixes folke#799
  feat(config): added `Noice all` to show ALL messages captured by Noice. See folke#769
  chore(main): release 2.0.3 (folke#800)
  chore(build): auto-generate vimdoc
  fix(nui): safely destroy any create window/buffers during E565 errors. Fixes command preview
  fix(hacks): use feedkeys instead of input to force redraw
adoyle-h added a commit to adoyle-h/one.nvim that referenced this issue Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants