Skip to content

Commit

Permalink
fix: remove deprecated opt for conform.nvim (nvim-lua#1070)
Browse files Browse the repository at this point in the history
- changed lsp_fallback -> lsp_format
- updated format_on_save function to reflect change above
  • Loading branch information
iton0 authored and Matthew Lemon committed Sep 9, 2024
1 parent 30be436 commit 98ce4ef
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ require('lazy').setup({
{
'<leader>f',
function()
require('conform').format { async = true, lsp_fallback = true }
require('conform').format { async = true, lsp_format = 'fallback' }
end,
mode = '',
desc = '[F]ormat buffer',
Expand All @@ -977,9 +977,15 @@ require('lazy').setup({
-- Disable "format_on_save lsp_fallback" for languages that don't
-- languages here or re-enable it for the disabled ones.
local disable_filetypes = { c = true, cpp = true }
local lsp_format_opt
if disable_filetypes[vim.bo[bufnr].filetype] then
lsp_format_opt = 'never'
else
lsp_format_opt = 'fallback'
end
return {
timeout_ms = 500,
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
lsp_format = lsp_format_opt,
}
end,
formatters_by_ft = {
Expand Down

0 comments on commit 98ce4ef

Please sign in to comment.