Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Fix(features/linter): broken format on save #413

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions lua/doom/modules/features/linter/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ linter.configs["null-ls.nvim"] = function()
vim.cmd([[
augroup LspFormatting
autocmd! * <buffer>
autocmd BufWritePre <buffer> lua type(vim.lsp.buf.format) == "function" and vim.lsp.buf.format() or vim.lsp.buf.formatting_sync()
autocmd BufWritePre <buffer> lua if vim.lsp.buf.format ~= nil then vim.lsp.buf.format() else vim.lsp.buf.formatting_sync() end
augroup END
]])
end
Expand All @@ -45,7 +45,7 @@ linter.binds = {
"<leader>cf",
function()
local null_ls_settings = doom.features.linter.settings.null_ls_settings
if type(vim.lsp.buf.format) == "function" then
if vim.lsp.buf.format ~= nil then
vim.lsp.buf.format({
timeout_ms = null_ls_settings.default_timeout,
})
Expand Down