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: Cannot use trouble due to lua error #465

Closed radu781 closed 1 month ago

radu781 commented 1 month ago

Did you check docs and existing issues?

Neovim version (nvim -v)

NVIM v0.10.0-dev-2752+g35239e977

Operating system/version

Windows 10

Describe the bug

Cannot use trouble due to lua error, using latest trouble version, I had no issues with this until yesterday, maybe because of a version update

E5108: Error executing lua: ...k\packer\start\trouble.nvim/lua/trouble/sources/init.lua:40: attempt to index local 'source' (a nil value)
stack traceback:
        ...k\packer\start\trouble.nvim/lua/trouble/sources/init.lua:40: in function 'get'
        ...k\packer\start\trouble.nvim/lua/trouble/view/section.lua:33: in function 'new'
        ...pack\packer\start\trouble.nvim/lua/trouble/view/init.lua:59: in function 'new'
        ...\site\pack\packer\start\trouble.nvim/lua/trouble/api.lua:52: in function 'toggle'
        [string ":source (no file)"]:59: in function <[string ":source (no file)"]:59>

Steps To Reproduce

require("trouble").toggle("document_diagnostics") require("trouble").toggle("workspace_diagnostics")

Expected Behavior

It's supposed to not error and show diagnostics for the current file or workspace

Repro

No response

folke commented 1 month ago

Trouble v3 was merged in main. Please check the docs. Those are no longer valid modes. I just updated the code to show a proper error message in this case.