You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When multiple formatters are specified for the same file, the normal and desired behavior is to group all format operations as a single transaction so that a single undo operation will undo the effects of all formatters. However, LSP code actions are executed differently and prevent the transaction from being grouped properly leading to multiple history entries
Steps to trigger the problem:
Add the following to language settings and install ruff + python extensions
break up execute_code_actions_on_servers and deserialize_workspace_edits
one that just generates the list of edits
another that executes the edits
call the edit generation fn from execute_formatters during gather step and call execution fn during exec step, passing param to prevent finalize_ last_transaction from being called
refactor execute_code_actions_on_servers and deserialize_workspace_edits to call into the new functions as appropriate based on their usage elsewhere
Summary
When multiple formatters are specified for the same file, the normal and desired behavior is to group all format operations as a single transaction so that a single undo operation will undo the effects of all formatters. However, LSP code actions are executed differently and prevent the transaction from being grouped properly leading to multiple history entries
Steps to trigger the problem:
replace the contents of
hello.py
with the followingActual Behavior:
Only the import sorting is undone, resulting in the following
Expected Behavior:
Both the import sorting and the formatting should be undone (the following is after hitting undo twice instead of once)
Relevant Code
crates/project/src/lsp_store.rs > execute_formatters
crates/project/src/lsp_store.rs > execute_code_actions_on_servers
crates/project/src/lsp_store.rs > deserialize_workspace_edits
Plan
execute_code_actions_on_servers
anddeserialize_workspace_edits
execute_formatters
during gather step and call execution fn during exec step, passing param to preventfinalize_ last_transaction
from being calledexecute_code_actions_on_servers
anddeserialize_workspace_edits
to call into the new functions as appropriate based on their usage elsewhereZed Version and System Specs
Zed: v0.174.0 (Zed Nightly 6f7f0f3)
OS: Linux X11 endeavouros unknown
Memory: 31.3 GiB
Architecture: x86_64
GPU: NVIDIA GeForce RTX 3070 || NVIDIA || 565.77
The text was updated successfully, but these errors were encountered: