Skip to content

Commit

Permalink
update autoformatting to only when available
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesChung committed Aug 23, 2024
1 parent 812626b commit 5f56503
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lua/plugins/lspconfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ return {
lsp_zero.extend_lspconfig()

lsp_zero.on_attach(function(client, bufnr)
lsp_zero.buffer_autoformat()
-- Check if the client supports formatting
if client.server_capabilities.documentFormattingProvider then
lsp_zero.buffer_autoformat()
end
end)

lsp_zero.set_sign_icons({
Expand Down

0 comments on commit 5f56503

Please sign in to comment.