From 38c4421eea0b2c6ac298ba1d944b34ee423d7590 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Tue, 13 Dec 2022 11:21:15 -0500 Subject: [PATCH] Update init.lua --- init.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index d085ade..d35ebf7 100644 --- a/init.lua +++ b/init.lua @@ -324,7 +324,11 @@ local on_attach = function(_, bufnr) -- Create a command `:Format` local to the LSP buffer vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) - vim.lsp.buf.format() + if vim.lsp.buf.format then + vim.lsp.buf.format() + elseif vim.lsp.buf.formatting then + vim.lsp.buf.formatting() + end end, { desc = 'Format current buffer with LSP' }) end