Closed simonmandlik closed 1 month ago
NVIM v0.10.0-dev-2949+g206475d79-Homebrew
MacOS 14.4.1
I can't get auto_open and auto_close to work even in the simplest configuration. Am I missing something?
auto_open
auto_close
nvim -u repro.lua
<leader>a
<leader>r
<leader>xx
I would expect the Trouble window to open after first <leader>a, and close after last <leader>r.
Actual behavior:
https://github.com/folke/trouble.nvim/assets/16707112/1bb164f9-54e9-434a-af77-e874e06cb0f3
Thanks for the plugin!
Btw, the issue template for v3 doesn't contain branch = "dev", this may lead some people into installing v2 when creating MWEs by mistakes.
v3
branch = "dev"
v2
-- 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) -- install plugins local plugins = { "folke/tokyonight.nvim", { "folke/trouble.nvim", branch = "dev", keys = { { "<leader>xx", "<cmd>Trouble diagnostics toggle<cr>", desc = "Diagnostics (Trouble)", }, }, opts = { auto_close = true, auto_open = true, } }, { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", config = function () require("nvim-treesitter.configs").setup { ensure_installed = { "markdown", "markdown_inline" }, } end }, } require("lazy").setup(plugins, { root = root .. "/plugins", }) vim.cmd.colorscheme("tokyonight") -- add anything else here local ns = vim.api.nvim_create_namespace("test") vim.keymap.set("n", "<leader>a", function() print("Adding diagnostics") vim.diagnostic.set(ns, 0, {{ lnum=0, col=0, message="test", severity = vim.diagnostic.severity.ERROR, }}) end) vim.keymap.set("n", "<leader>r", function() print("Removing diagnostics") vim.diagnostic.reset() end)
I have also noticed that the latest version of trouble auto closes too early (when resolving the current error, not all errors).
Should be fixed now. Thank you for the detailed bug report!
Did you check docs and existing issues?
Neovim version (nvim -v)
NVIM v0.10.0-dev-2949+g206475d79-Homebrew
Operating system/version
MacOS 14.4.1
Describe the bug
I can't get
auto_open
andauto_close
to work even in the simplest configuration. Am I missing something?Steps To Reproduce
nvim -u repro.lua
<leader>a
,<leader>r
<leader>xx
<leader>a
,<leader>r
Expected Behavior
I would expect the Trouble window to open after first
<leader>a
, and close after last<leader>r
.Actual behavior:
https://github.com/folke/trouble.nvim/assets/16707112/1bb164f9-54e9-434a-af77-e874e06cb0f3
Thanks for the plugin!
Repro
Btw, the issue template for
v3
doesn't containbranch = "dev"
, this may lead some people into installingv2
when creating MWEs by mistakes.