diff options
author | pommicket <pommicket@gmail.com> | 2023-10-17 20:01:15 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-10-17 20:06:12 -0400 |
commit | 85c30e8fb21170d602efb53a86c0000a3aa79cbf (patch) | |
tree | 6e883ebeb4a300ae92ef815350d9c7deb77e6a1c | |
parent | ed07fe85ec0b85d8d0ade65caac0f04b999890b4 (diff) |
switch back to starting file after rename
-rw-r--r-- | ide-rename-symbol.c | 17 | ||||
-rw-r--r-- | main.c | 1 |
2 files changed, 8 insertions, 10 deletions
diff --git a/ide-rename-symbol.c b/ide-rename-symbol.c index e5e30fb..a379d1d 100644 --- a/ide-rename-symbol.c +++ b/ide-rename-symbol.c @@ -118,19 +118,22 @@ void rename_symbol_process_lsp_response(Ted *ted, const LSPResponse *response) { || response->request.id != rs->request_id.id) { return; } - - const LSPResponseRename *data = &response->data.rename; LSP *lsp = ted_get_lsp_by_id(ted, rs->request_id.lsp); + + if (menu_is_open(ted, MENU_RENAME_SYMBOL)) + menu_close(ted); + const LSPResponseRename *data = &response->data.rename; if (!lsp) { // LSP crashed or something - goto cleanup; + return; } + TextBuffer *const start_buffer = ted_active_buffer(ted); arr_foreach_ptr(data->changes, const LSPWorkspaceChange, change) { if (change->type == LSP_CHANGE_DELETE && change->data.delete.recursive) { ted_error(ted, "refusing to perform rename because it involves a recursive deletion\n" "I'm too scared to go through with this"); - goto cleanup; + return; } } @@ -202,11 +205,7 @@ void rename_symbol_process_lsp_response(Ted *ted, const LSPResponse *response) { ted_save_all(ted); } - - cleanup: - rename_symbol_clear(ted); - if (menu_is_open(ted, MENU_RENAME_SYMBOL)) - menu_close(ted); + ted_switch_to_buffer(ted, start_buffer); } void rename_symbol_init(Ted *ted) { @@ -1,6 +1,5 @@ /* TODO: -- switch back to starting file after rename - .editorconfig (see https://editorconfig.org/) FUTURE FEATURES: - autodetect indentation (tabs vs spaces) |