-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get diagnostics from location list and quickfix list #24
Comments
Should be rather easy once #26 is merged, either as a handler in your configs or in the project, if @petertriho wants to include this. |
Yep, sorry been a little busy. Will test and merge it over the weekend |
Now that custom handlers exist, I wrote a simple handler to support entries in the location list. require("scrollbar.handlers").register("locationlist", function(bufnr)
local winnr = vim.fn.get(vim.fn.win_findbuf(bufnr), 0, -1)
if winnr == -1 then
return {}
end
local ll = vim.fn.getloclist(winnr)
local marks = {}
for _, entry in pairs(ll) do
table.insert(marks, { line = entry.lnum, type = mark_type_map[entry.type]})
end
return marks
end) Should I create another pull request and add this as an example in the readme or create a dedicated handler script? Unfortunately, there is no autocmd for when the location list was updated, so the markers don't refresh automatically until one of the configured autocmds is triggered, e.g. scrolling. I also tried the following, but that also didn't work. augroup scrollbar_loclist
autocmd!
autocmd User ALELintPost,ALEFixPost,CocDiagnosticChange lua require('scrollbar.handlers').show();require('scrollbar').render()
augroup END |
This is something I definitely want to add as a in-built handler and, eventually, add a wiki for other things. I'll investigate further over the weekend, but have you tried: " quickfix
autocmd QuickFixCmdPost [^l]* lua require('scrollbar.handlers').show();require('scrollbar').render()
" location
autocmd QuickFixCmdPost l* lua require('scrollbar.handlers').show();require('scrollbar').render() Probably should refactor |
I've tried |
Looks like we'll need to handle both local function qf_test()
local winid = vim.api.nvim_get_current_win()
local info = vim.fn.getwininfo(winid)
local winnr = info[1].winnr
local loclist = vim.fn.getloclist(winnr)
end
vim.api.nvim_add_user_command("QuickfixTest", qf_test, {})
-- autocmd Filetype qf QuickfixTest |
Ok, to be more precise, the autocmds get called, but the location list has not been updated at this point. |
Is your feature request related to a problem? Please describe.
Currently diagnostics only seem to be fetched from LSP. However, I also use ALE and all those diagnostics don't appear in the scrollbar.
Describe the solution you'd like
Include entries from the location and quckfix list into the sidebar.
I did a quick research on how to accomplish that.
You can call
getloclist()
andgetqflist()
, which will return a list of dicts. Each dict contains a "type" key that can be "I", "W", or "E", and an "lnum" key for the line number. Forgetqflist
you probably also have to compare the "bufnr" key to the current buffer.getloclist
accepts an argument to specifiy the current window.Then proceed as usual to add a marker.
The text was updated successfully, but these errors were encountered: