fixed range formatting with ^>= 0.8

This commit is contained in:
Oliver Hartmann 2022-09-16 10:18:07 +02:00
parent a24b928433
commit a85b634110

View File

@ -70,7 +70,11 @@ local on_attach = function(client, bufnr)
end
end
if client.server_capabilities.documentRangeFormattingProvider then
vim.keymap.set('v', '<space>f', vim.lsp.buf.range_formatting, opts)
if vim.version().minor >= 8 then
vim.keymap.set('v', '<space>f', vim.lsp.buf.format, opts)
else
vim.keymap.set('v', '<space>f', vim.lsp.buf.range_formatting, opts)
end
end
-- Set autocommands conditional on server_capabilities