aboutsummaryrefslogtreecommitdiff
path: root/test/functional/vimscript/screenpos_spec.lua
diff options
context:
space:
mode:
authorFolke Lemaitre <folke.lemaitre@gmail.com>2023-06-05 01:45:01 +0200
committerGitHub <noreply@github.com>2023-06-04 16:45:01 -0700
commit5282d3299c9b1b07f3e02a9014bc2632cf3b4fed (patch)
tree88a2894d6fa3c7432373e789d8a80d069ced0e0f /test/functional/vimscript/screenpos_spec.lua
parent67827edeef5ce3718c40c83ccca07dd1854a0f16 (diff)
downloadrneovim-5282d3299c9b1b07f3e02a9014bc2632cf3b4fed.tar.gz
rneovim-5282d3299c9b1b07f3e02a9014bc2632cf3b4fed.tar.bz2
rneovim-5282d3299c9b1b07f3e02a9014bc2632cf3b4fed.zip
fix(lsp): restore marks after apply_text_edits() #14630
PROBLEM: Whenever any text edits are applied to the buffer, the `marks` part of those lines will be lost. This is mostly problematic for code formatters that format the whole buffer like `prettier`, `luafmt`, ... When doing atomic changes inside a vim doc, vim keeps track of those changes and can update the positions of marks accordingly, but in this case we have a whole doc that changed. There's no simple way to update the positions of all marks from the previous document state to the new document state. SOLUTION: * save marks right before `nvim_buf_set_lines` is called inside `apply_text_edits` * check if any marks were lost after doing `nvim_buf_set_lines` * restore those marks to the previous positions TEST CASE: * have a formatter enabled * open any file * create a couple of marks * indent the whole file to the right * save the file Before this change: all marks will be removed. After this change: they will be preserved. Fixes #14307
Diffstat (limited to 'test/functional/vimscript/screenpos_spec.lua')
0 files changed, 0 insertions, 0 deletions