[Bugfix]: Don't override formatter with empty exe (#1224)

* fix(lsp): don't override formatter with empty exe

* Check for nil value
This commit is contained in:
Pasi Bergman 2021-08-04 16:12:01 +03:00 committed by GitHub
parent 7cd03ff4e3
commit db19d4c13c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -71,7 +71,7 @@ function M.common_on_init(client, bufnr)
end
local formatters = lvim.lang[vim.bo.filetype].formatters
if not vim.tbl_isempty(formatters) then
if not vim.tbl_isempty(formatters) and formatters[1]["exe"] ~= nil and formatters[1].exe ~= "" then
client.resolved_capabilities.document_formatting = false
u.lvim_log(string.format("Overriding [%s] formatter with [%s]", client.name, formatters[1].exe))
end