fix(quickfix): wait until it is safe to open the quickfix list#30
fix(quickfix): wait until it is safe to open the quickfix list#30Subjective wants to merge 2 commits intostevearc:masterfrom
Conversation
|
As written this PR won't work, since the |
|
Here's a minimal repro: -- save as repro.lua
-- run with nvim -u repro.lua
-- DO NOT change the paths
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "runtime", "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)
vim.g.mapleader = " "
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
{
"nvim-telescope/telescope.nvim",
cmd = "Telescope",
dependencies = {
"nvim-lua/plenary.nvim",
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
},
},
opts = {},
config = function(_, opts)
local telescope = require("telescope")
telescope.setup(opts)
telescope.load_extension("fzf")
end,
keys = { { "<leader>f", "<cmd>Telescope find_files<cr>" } },
},
{ "kevinhwang91/nvim-bqf", ft = "qf", opts = {} },
{
"stevearc/resession.nvim",
opts = {},
keys = {
{
"<leader>s",
function()
require("resession").save()
end,
},
{
"<leader>l",
function()
require("resession").load()
end,
},
},
},
-- add any other plugins here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else hereThis is a clip of me replicating the issue: https://asciinema.org/a/E2D9AKQdCwwhtaEVfkfTrroPu It seems that |
|
nvim-bqf needed the quickfix to be populated earlier. I've fixed this by adding a new method to the extension API: |
I'm not sure why this might be the case, but it seems like nvim-bqf completely breaks in the first qf window restored by resession quickfix extension on startup.
Either deferring the callback of
:copenorsetqflist()resolves this, but the former seems to have the added benefit of properly restoring the quickfix list if the cursor was last in the qf window upon last saving the session (an entirely separate issue btw). Unfortunately, this also means that if the cursor was not previously in the qf window, then it is incorrectly set to the qf window upon restoring the session.This is a rough proposal, do let me know if you have any better ideas.