Git Product home page Git Product logo

Comments (7)

petertriho avatar petertriho commented on June 16, 2024 1

Yep, sorry been a little busy. Will test and merge it over the weekend

from nvim-scrollbar.

tbung avatar tbung commented on June 16, 2024

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.

from nvim-scrollbar.

mphe avatar mphe commented on June 16, 2024

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

from nvim-scrollbar.

petertriho avatar petertriho commented on June 16, 2024

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 require('scrollbar.handlers').show() to accept an optional handler name + buffer number to only update that handler

from nvim-scrollbar.

mphe avatar mphe commented on June 16, 2024

I've tried QuickFixCmdPost but it doesn't work, too. According to the docs it only applies to the quick fix list.

from nvim-scrollbar.

petertriho avatar petertriho commented on June 16, 2024

Looks like we'll need to handle both QuickFixCmdPost and Filetype qf autocmds to support qf/location list but the scrollbar render implementation needs to change since it only works with current buffer/window

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

from nvim-scrollbar.

mphe avatar mphe commented on June 16, 2024

Ok, to be more precise, the autocmds get called, but the location list has not been updated at this point.
I haven't implemented a quickfix list handler, yet.

from nvim-scrollbar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.