folke / trouble.nvim

🚦 A pretty diagnostics, references, telescope results, quickfix and location list to help you solve all the trouble your code is causing.
Apache License 2.0
5.11k stars 173 forks source link

bug: No results for **diagnostics** or other modes error shown #517

Closed illya-laifu closed 1 week ago

illya-laifu commented 1 week ago

Did you check docs and existing issues?

Neovim version (nvim -v)

v0.10.0

Operating system/version

6.9.5-arch1-1

Describe the bug

Message: No results for **diagnostics**, shown when command :Trouble diagnostics toggle is ran.

Steps To Reproduce

  1. Run Trouble diagnostics toggle
  2. Error message appears

Expected Behavior

A diagnostics window should open.

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)                                                                                                                                                                                                                                                       

-- install plugins                                                                                                                                                                                                                                                                          
local plugins = {                                                                                                                                                                                                                                                                           
  "folke/tokyonight.nvim",                                                                                                                                                                                                                                                                  
  {"folke/trouble.nvim",                                                                                                                                                                                                                                                                    
        opts = {},                                                                                                                                                                                                                                                                          
  }                                                                                                                                                                                                                                                                                         
  -- add any other plugins here                                                                                                                                                                                                                                                             
}                                                                                                                                                                                                                                                                                           
require("lazy").setup(plugins, {                                                                                                                                                                                                                                                            
  root = root .. "/plugins",                                                                                                                                                                                                                                                                
})                                                                                                                                                                                                                                                                                          

vim.cmd.colorscheme("tokyonight")                                                                                                                                                                                                                                                           
-- add anything else here
b0ae989c commented 1 week ago

This is not a bug. The option is warn_no_results = true by default. Should close.

illya-laifu commented 1 week ago

Understood, closing.

Got confused, because before I was able to open the Scratch window even without the results. Not going to do it, but out of curiosity, is there an option to bring back the old behavior?

b0ae989c commented 1 week ago

is there an option to bring back the old behavior?

Yes. Try

{
  "folke/trouble.nvim",                                                                                                                                                                                                                                                                    
  opts = {
    warn_no_results = false,
    open_no_results = true,
  },                                                                                                                                                                                                                                                                          
}