Closed daUnknownCoder closed 4 months ago
Thanks, but you can just use #require("lint").get_running()
.
Thanks, but you can just use
#require("lint").get_running()
.
i was struggling to use this:
{
function()
local lint_progress = function()
local linters = require("lint").get_running()
if #linters == 0 then
return " Linting completed"
end
return " Linting with '" .. table.concat(linters, ", ") .. "' in progress"
end
return lint_progress()
end,
},
i m using lualine
but, it gives me <icon> Linting completed
for a non linted file too, like if i do nvim ifregre.reger
it still gives me linting completed but there is no linting happening... which is why i was fiddling with that functions... can you help me with that?
You can specify the buffer number for which to get the running linters and use 0 for current buffer - e.g.: require("lint").get_running(0)
require("lint").get_running(0)
I mean that when I use get_running, if the current buffer's filetype has no linter installed, there should be no linter found
instead of linting completed
as per #linters==0
, I want to have a get a if elseif else
, like
if #linters==none
return "No linters found"
elseif #linters==0
return "Linting completed"
else #linters>0
return "Linting in progress"
Can I get something like that?
The problem with that is that users can call try_lint
without having configured the linter.
nvim-lint doesn't have the complete information over which linters could be triggered and how.
Because of that it's up to users to decide how & what information to display exactly.
get_running
only displays the number of running linters, not configured linters. Having a get_running_linter_count()
method that returns the configured linters would be misleading, and could be incorrect. For example I have a require("lint").try_lint("ruff")
call in a BufWritePost
autocmd, and ruff
is not in the linters_by_ft
table
so from what i understand, there's no way to achieve no linters found
like i just wanna check the ft
and if it does not have a linter or if the linter is not installed
Checks number of current linters