Keep support for depracated format syntax in version <= 7

This commit is contained in:
Evie Litherland-Smith 2022-11-07 16:04:36 +00:00
parent a252a8d543
commit da7767a1fb

View file

@ -29,9 +29,16 @@ local on_attach = function(client, bufnr)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts) vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts) vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
vim.keymap.set('n', '<leader>i', function () -- Keep support for deprecated syntax in vim <= 7
vim.lsp.buf.format({timeout_ms=10000,async=false}) -- async=true is strange behavior if vim.version().major <= 7 then
end, bufopts) vim.keymap.set('n', '<leader>i', function ()
vim.lsp.buf.formatting_sync({timeout_ms=10000})
end, bufopts)
else
vim.keymap.set('n', '<leader>i', function ()
vim.lsp.buf.format({timeout_ms=10000,async=false})
end, bufopts)
end
-- Enable aerial support -- Enable aerial support
require("aerial").on_attach(client, bufnr) require("aerial").on_attach(client, bufnr)
end end