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 Aug 26, 2024
1 parent e4a5300 commit c76c323
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 @@ -675,7 +675,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 @@ -688,9 +688,15 @@ require('lazy').setup({
-- have a well standardized coding style. You can add additional
-- 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 c76c323

Please sign in to comment.