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.36k stars 175 forks source link

read item contents by `bufnr` instead of reading file by path #287

Closed eatgrass closed 1 year ago

eatgrass commented 1 year ago
  local fd = assert(uv.fs_open(filename, "r", 438))

the filename might not be an valid file path, for example, the jdtls could return something like this jdt://contents/commons-collections4-4.4.jar/org.apache.commons.collections4.list/AbstractLinkedList.class?=b

it causes an error

stack traceback:
        [C]: in function 'assert'
        ....local/share/nvim/lazy/trouble.nvim/lua/trouble/util.lua:150: in function 'process_item'
        ....local/share/nvim/lazy/trouble.nvim/lua/trouble/util.lua:193: in function 'locations_to_items'
        ...are/nvim/lazy/trouble.nvim/lua/trouble/providers/lsp.lua:44: in function 'handler'
        ...are/nvim/lazy/trouble.nvim/lua/trouble/providers/lsp.lua:9: in function 'handler'
        ...w/Cellar/neovim/0.9.0/share/nvim/runtime/lua/vim/lsp.lua:1394: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>
folke commented 1 year ago

That was actually an optimization so we don't need to load the buffer to get those lines. It made a huge difference in performance.

Can you change the impl so that it only does that when filename is an uri and not a file?

folke commented 1 year ago

thanks!

eatgrass commented 1 year ago

I am glad to contribute to this great plugin