The workspace edit may add or delete lines, so resetting it to the last
linenumber and column will very likely not match the last logical line
before the workspaceEdit operation.
For example an action might add an auto-import statement at the top of
the file, effectively adding one line in-between. If we now reset the
cursor, we will end up one logical line before the one where we actually
started at.
This behaviour is automatically fixed if we just don't reset the cursor
at all.
return
endif
- var save_cursor: list<number> = getcurpos()
for [uri, changes] in workspaceEdit.changes->items()
var bnr: number = util.LspUriToBufnr(uri)
if bnr == 0
# interface TextEdit
ApplyTextEdits(bnr, changes)
endfor
- # Restore the cursor to the location before the edit
- save_cursor->setpos('.')
enddef
# vim: tabstop=8 shiftwidth=2 softtabstop=2