mfussenegger / nvim-lint

An asynchronous linter plugin for Neovim complementary to the built-in Language Server Protocol support.
GNU General Public License v3.0
1.76k stars 191 forks source link

`require("lint").get_running()` not returning anything #583

Closed gennaro-tedesco closed 1 month ago

gennaro-tedesco commented 1 month ago

I am trying to output the linters that are active upon each buffer and I seemingly cannot get require("lint").get_running() to return any result (although the linters are active and all works fine): see example below

https://github.com/mfussenegger/nvim-lint/assets/15387611/23b60368-0b13-4644-a45d-8b7357b1e30f

you can see that ruff is active as a linter, producing the expected output, however the method get_running() does not return anything: the same holds true for any other filetype and/or linter.

Do I misunderstand how it is supposed to work or has any of the recent commits perhaps introduced a bug in said function (it should work, but it doesn't)?

daniele821 commented 1 month ago

i was trying to write a function to show active linters in lualine, and i have the same problem. I have shellcheck running on sh files, but the method get_running() returns an empty table.

I also tried passing the current buffer, but it still returns an empty table

Update: it's definitely a bug, as the function does actually returns the correct linters for few seconds after i edit a new file, but then it stop, and return nothing. I have no idea what could cause it

here's a recording about this (in the statusline uses the get_running() function to get the linters. notice how it shows shellcheck for a second and then it disappear Screencast_20240520_161559.webm

winter-again commented 1 month ago

Sounds like expected behavior

daniele821 commented 1 month ago

Sounds like expected behavior

seeing that this already got report as a bug at least twice, it's at the very least a strange behaviour. I can understand why it is like this, but it would be nice to be able to always know what linters are corrently active on the current buffer. That in my opinion would be generally more useful

mfussenegger commented 1 month ago

Then use require("lint").linters_by_ft[vim.bo.filetype] or {}