Skip to content

Commit c76c323

Browse files
authored
fix: remove deprecated opt for conform.nvim (nvim-lua#1070)
- changed lsp_fallback -> lsp_format - updated format_on_save function to reflect change above
1 parent e4a5300 commit c76c323

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

init.lua

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ require('lazy').setup({
675675
{
676676
'<leader>f',
677677
function()
678-
require('conform').format { async = true, lsp_fallback = true }
678+
require('conform').format { async = true, lsp_format = 'fallback' }
679679
end,
680680
mode = '',
681681
desc = '[F]ormat buffer',
@@ -688,9 +688,15 @@ require('lazy').setup({
688688
-- have a well standardized coding style. You can add additional
689689
-- languages here or re-enable it for the disabled ones.
690690
local disable_filetypes = { c = true, cpp = true }
691+
local lsp_format_opt
692+
if disable_filetypes[vim.bo[bufnr].filetype] then
693+
lsp_format_opt = 'never'
694+
else
695+
lsp_format_opt = 'fallback'
696+
end
691697
return {
692698
timeout_ms = 500,
693-
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
699+
lsp_format = lsp_format_opt,
694700
}
695701
end,
696702
formatters_by_ft = {

0 commit comments

Comments
 (0)