nvim: lsp: Fix enabling of range format support again!
47b1578
did not actually fix it. We need to keep using 'gq' but actually
correctly specify whether we want normal or visual mode. Also disable
range formatting explicitly for tsserver.
This commit is contained in:
parent
d7fbe762c5
commit
b95a14b8d1
1 changed files with 5 additions and 3 deletions
|
@ -69,8 +69,9 @@ local on_attach = function(client, bufnr)
|
|||
vim.api.nvim_buf_set_keymap(bufnr, 'n', ',d', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>' , opts)
|
||||
|
||||
if client.resolved_capabilities.document_range_formatting then
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gq', '<cmd>lua format_range_operator()<CR>', opts)
|
||||
elseif client.resolved_capabilities.document_formatting then
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'x', 'gq', '<cmd>lua format_range_operator()<CR>', opts)
|
||||
end
|
||||
if client.resolved_capabilities.document_formatting then
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gq', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||
end
|
||||
|
||||
|
@ -109,7 +110,8 @@ local on_attach = function(client, bufnr)
|
|||
|
||||
if client.name == 'tsserver' then
|
||||
-- Disable tsserver formatting as we plan on formatting via null-ls
|
||||
client.resolved_capabilities.document_formatting = false
|
||||
client.resolved_capabilities.document_formatting = false
|
||||
client.resolved_capabilities.document_range_formatting = false
|
||||
|
||||
ts_utils.setup {
|
||||
debug = false,
|
||||
|
|
Loading…
Reference in a new issue