Giter VIP home page Giter VIP logo

Comments (2)

piotr-machura avatar piotr-machura commented on June 7, 2024 1

To expand on this: neovim 0.6 nightly fetaures a handy setqflist in addition to the already available setloclist, which adds workspace diagnostics to the quickfix list (similar to what this plugin does).

I am currently using something like this in my personal config:

function update_diagnostics(global_too)
    if not vim.lsp.buf.server_ready() then
        return
    end
    if vim.fn.getloclist(vim.fn.winnr(), { title = 0 }).title == 'Buffer diagnostics' then
        vim.diagnostic.setloclist{ open = false, title = 'Buffer diagnostics' }
    end
    if global_too and vim.fn.getqflist{ title = 0 }.title == 'Workspace diagnostics' then
        vim.diagnostic.setqflist{ open = false,  title = 'Workspace diagnostics' }
    end
end

and in my setup.on_attach callback I have

vim.api.nvim_command('autocmd BufWinEnter * lua update_diagnostics(false)')
vim.api.nvim_command('autocmd User DiagnosticsChanged lua update_diagnostics(true)')
vim.api.nvim_buf_set_keymap(0, 'n', '<C-k>k','<CMD>silent! lua vim.diagnostic.setloclist{ title = "Buffer diagnostics" }<CR>', {noremap=true})
vim.api.nvim_buf_set_keymap(0, 'n', '<C-k><C-k>','<CMD>silent! lua vim.diagnostic.setqflist{ title = "Workspace diagnostics" }<CR>', {noremap=true})

This allows me to use all kinds of non-standard quickfix/location lists (references, implementations, symbols etc.) and populate them with auto-updating diagnostics using a keymap.

Something similar (but much more polished) could be integrated into this plugin (although the "release" neovim 0.5.1 does not have setqflist yet).

from diaglist.nvim.

onsails avatar onsails commented on June 7, 2024 1

Hi @piotr-machura , I finally found time to fully adapt plugin to 0.6.x and test your idea. Apparently it works well so master now uses title to identify foreign quickfix! Thank you for the great idea and wonderful examples.

Foreign loclist is still to be done.

from diaglist.nvim.

Related Issues (10)

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.