nvim: statusline: Fix tree-sitter status

Fixing based on file type was not good enough. Check for error
return and act accordingly.
This commit is contained in:
Sanchayan Maity 2022-02-13 12:33:17 +05:30
parent ac3039d64b
commit 6bf989871e

View file

@ -171,16 +171,15 @@ M.progress = function()
end
M.treesitter_status = function()
local filetype = vim.bo.filetype
local ignore_ft = { 'diff', 'fugitive', 'git', 'markdown', 'qf', 'text', '' }
for _, v in pairs(ignore_ft) do
if v == filetype then
return ""
end
end
if gps.is_available then
return string.format("%s%s", ' %#TSStatus#', gps.get_location())
local location = gps.get_location()
if location == 'error' then
return ''
else
return string.format("%s%s", ' %#TSStatus#', location)
end
else
return ''
end
end