feat(lsp): incremental-selection operator-pending mode #36575

Problem:
LSP incremental selection provides default visual-mode keymaps for `an`
and `in`. Operator-pending mode is not supported, so `dan` and `can` do
not apply the operation.

Solution:
Modify selection_range() to be synchronous.
Add operator-pending mappings.
This commit is contained in:
Branden Call
2025-11-24 18:10:50 -07:00
committed by GitHub
parent 60c35cc4c7
commit e82aef2e22
3 changed files with 69 additions and 58 deletions

View File

@@ -227,6 +227,14 @@ do
vim.lsp.buf.selection_range(-vim.v.count1)
end, { desc = 'vim.lsp.buf.selection_range(-vim.v.count1)' })
vim.keymap.set('o', 'an', function()
vim.lsp.buf.selection_range(vim.v.count1, 1000)
end, { desc = 'vim.lsp.buf.selection_range(vim.v.count1, timeout_ms)' })
vim.keymap.set('o', 'in', function()
vim.lsp.buf.selection_range(-vim.v.count1, 1000)
end, { desc = 'vim.lsp.buf.selection_range(-vim.v.count1, timeout_ms)' })
vim.keymap.set('n', 'gO', function()
vim.lsp.buf.document_symbol()
end, { desc = 'vim.lsp.buf.document_symbol()' })