Giter VIP home page Giter VIP logo

diaglist.nvim's Introduction

Live-updating Neovim LSP diagnostics in quickfix and loclist

demo

Features

  • workspace diagnostics of all buffers in quickfix
    • prioritize current buf diagnostics
    • live diagnostics update
    • no conflicts with other commands using quickfix
    • optionally show only current buffer's clients diagnostics
    • debounce
  • current buffer diagnostics in loclist
    • live diagnostics update
    • no conflicts with other commands using loclist
    • debounce

Setup

lua require("diaglist").init({
    -- optional settings
    -- below are defaults
    debug = false, 

    -- increase for noisy servers
    debounce_ms = 150,
})

Init sets diag update on LspDiagnosticsChanged, WinEnter, BufEnter for live diagnostics update and QuickFixCmdPre to avoid conflicts with other commands using quickfix.

Mappings

There are no default mappings. Here is an example:

nmap <space>dw <cmd>lua require('diaglist').open_all_diagnostics()<cr>
nmap <space>d0 <cmd>lua require('diaglist').open_buffer_diagnostics()<cr>

diaglist.nvim's People

Contributors

gw31415 avatar onsails avatar piotr-machura avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

diaglist.nvim's Issues

diaglist.nvim does not populate :copen only after open_all_diagnostics

Hi @onsails,
Thank you for your plugin. I use it with the sample config:

lua require("diaglist").init({
    debug = false, 
    debounce_ms = 150,
})

I noticed the quickfix only populated after I call lua require('diaglist').open_all_diagnostics() which sets the window title and in this way lets the vim.fn.getqflist{ title = 0 }.title ~= check to pass.
So currently, I always get the print('foreign quickfix, not populating') message for using :copen.
I'm wondering why does it work like this? Should the README point it out?

Auto-open quickfix list on errors?

Forgive me if I'm missing something obvious, but is there an easy way when using this plugin to have the quickfix list open automatically when there are errors? Something like neomake's behavior?

The lists do not update when there are no warnings/errors

As stated in the title, these lines in loclist.lua

  if warnings + errors > 0 then

and quickfix.lua

  if #all_diagnostics > 0 then

prevent the lists from updating when there are no errors/warnings left.
Screenshot:
screenshot_240681
Then I comment the incorrect line and the windows closes, but another :copen shows the errors still there:
screenshot_953216
Edit: I have created a PR with a possible simple solution. Let me know what you think.

Export `populate_qflist()` publicly

Hello. I am always grateful for this plugin. Sorry for my poor English.

Why don't you export the local function populate_qflist() in lua/diaglist/quickfix.lua publicly?

In my case, I want to add a diaglist to the quickfix list on LspAttach events (or equivalent timing: e.g. nvim-lspconfig callback function), but I do not want to display the quickfix window at that time.

Use title to determine wheather to update the quickfix/location list

The plugin sets a flag on QuickFixCmdPre to signify that the quickfix has been populated by something other than the diagnostics. This unfortunatelly conflicts with non-builtin functions utilizing quickfix (like vim.lsp.buf.workspace_symbol() or vim.lsp.buf.references()).

Both this and the current issue of not respecting foregin location lists can be fixed using setqflist() (and getqflist(), setloclist(), getloclist()), perhaps by specifying the lists' ID or even just the title. The lsp_diagnostic_hook can then check if current quickfix list has a specific title (say "Diagnostics") and only then update. If the user wants to force the update they can do so with open_all_diagnostics() or open_buffer_diagnostics().

I would try making a PR myself, but the above are vimscript functions and I have no clue how to nicely use them from lua.

[NVIM v0.6.0-dev] Diaglist does not let go of cursor focus and makes nvim unusable

$ nvim --version
NVIM v0.6.0-dev+274-g6188926e0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

After installing diaglist, here's what happens when I enter a buffer with an LSP attached to it:

diaglist-bug.mp4

Basically, the diaglist window appears and steals focus. If I try to go to another buffer, focus immediately goes back to diaglist.

I've set up diaglist with just:

require("diaglist").init({})

On NVIM v0.5.1, diaglist works just fine!

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.