summaryrefslogtreecommitdiff
path: root/autoload/ale/rename.vim
diff options
context:
space:
mode:
authorJerko Steiner <jerko.steiner@gmail.com>2022-02-08 12:07:39 +0100
committerGitHub <noreply@github.com>2022-02-08 20:07:39 +0900
commit4a4516e3bf792300f377c435c2206526a8963103 (patch)
tree7e0b2951cc32f55fe72dfc2cea440da7b0343eee /autoload/ale/rename.vim
parent8b1ea33cc0cb18bec3bf19d1131b322b313cea4e (diff)
downloadale-4a4516e3bf792300f377c435c2206526a8963103.zip
Dispatch textDocument/didChange after rename (2) (#4049)
* Dispatch textDocument/didChange after rename Previously whenever we renamed a symbol that was referenced from other files we'd just edit those files in the background, and the LSP wouldn't know about these changes. If we tried to rename the same symbol again, the renaming would fail. In some scenarios, the operation would just be wrong. Here is an attempt to fix this issue. I also noticed another bug when using Go with `gopls` LSP and the `gofmt` fixer. Whenever the file was saved, the `gofmt` would run and reformat the file. But it seems there was some kind of a race condition so I disabled saving for now, and all of the modified files will be unsaved, so the user should call `:wa` to save them. I personally like this even better because I can inspect exactly what changes happened, and I instantly see them in the other opened buffers, which was previously not the case. Fixes #3343, #3642, #3781. * Address PR comments * Remove mode tests in corner case tests * Address PR comments * Save after ALERename and ALEOrganizeImports Also provide options to disable automatic saving, as well as instructions to enable `set hidden` before doing that. * Fix broken test * Save only when !&hidden * Update doc * Update doc * Add silent
Diffstat (limited to 'autoload/ale/rename.vim')
-rw-r--r--autoload/ale/rename.vim6
1 files changed, 4 insertions, 2 deletions
diff --git a/autoload/ale/rename.vim b/autoload/ale/rename.vim
index 9030618e..a722cc94 100644
--- a/autoload/ale/rename.vim
+++ b/autoload/ale/rename.vim
@@ -84,7 +84,8 @@ function! ale#rename#HandleTSServerResponse(conn_id, response) abort
\ 'changes': l:changes,
\ },
\ {
- \ 'should_save': 1,
+ \ 'conn_id': a:conn_id,
+ \ 'should_save': !&hidden,
\ },
\)
endfunction
@@ -116,7 +117,8 @@ function! ale#rename#HandleLSPResponse(conn_id, response) abort
\ 'changes': l:changes,
\ },
\ {
- \ 'should_save': 1,
+ \ 'conn_id': a:conn_id,
+ \ 'should_save': !&hidden,
\ },
\)
endif