aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.lua11
1 files changed, 1 insertions, 10 deletions
diff --git a/init.lua b/init.lua
index dd55949..3cd4626 100644
--- a/init.lua
+++ b/init.lua
@@ -333,16 +333,7 @@ end
local function vis_apply_textEdit(win, file, textEdit)
assert(win.file == file)
- local start_pos = lsp_pos_to_vis_sel(textEdit.range.start)
- local end_pos = lsp_pos_to_vis_sel(textEdit.range['end'])
-
- -- convert the LSP range into a vis range
- -- this destroys the current selection but we change it after the edit anyway
- win.selection.anchored = false
- win.selection:to(start_pos.line, start_pos.col)
- win.selection.anchored = true
- win.selection:to(end_pos.line, end_pos.col - 1)
- local range = win.selection.range
+ local range = lsp_range_to_vis_range(win, textEdit.range)
file:delete(range)
file:insert(range.start, textEdit.newText)