mirror of
https://github.com/neovim/neovim.git
synced 2026-10-26 07:30:20 -05:00
fix(lsp): respect range in linewise visual mode #41636
Problem: An explicitly passed `range` to `vim.lsp.buf.format()` in linewise visual mode is silently replaced by the selection. Solution: Parenthesise the mode check.
This commit is contained in:
1 parent
10fa98bb6e
commit
a58cee4512
1 file changed
+1
-1
@@ -631,7 +631,7 @@ function M.format(opts)
|
||||
local mode = api.nvim_get_mode().mode
|
||||
local range = opts.range
|
||||
-- Try to use visual selection if no range is given
|
||||
if not range and mode == 'v' or mode == 'V' then
|
||||
if not range and (mode == 'v' or mode == 'V') then
|
||||
range = range_from_selection(bufnr, mode)
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user