mirror of
https://github.com/tcaxle/kickstart.nvim.git
synced 2025-12-14 09:37:01 +00:00
Don't pass args to vim.lsp.buf.format/formatting
Args passed by nvim_buf_create_user_command to the callback creates errors with rust-analyzer on nvim 0.7.x and vim.lsp.buf.formatting.
This commit is contained in:
8
init.lua
8
init.lua
@@ -289,7 +289,13 @@ local on_attach = function(_, bufnr)
|
|||||||
end, '[W]orkspace [L]ist Folders')
|
end, '[W]orkspace [L]ist Folders')
|
||||||
|
|
||||||
-- Create a command `:Format` local to the LSP buffer
|
-- Create a command `:Format` local to the LSP buffer
|
||||||
vim.api.nvim_buf_create_user_command(bufnr, 'Format', vim.lsp.buf.format or vim.lsp.buf.formatting, { desc = 'Format current buffer with LSP' })
|
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
||||||
|
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
|
end
|
||||||
|
|
||||||
-- nvim-cmp supports additional completion capabilities
|
-- nvim-cmp supports additional completion capabilities
|
||||||
|
|||||||
Reference in New Issue
Block a user