Fix race condition between auto-indent and on-type-formatting (#32005)
This PR addresses to fix (#31308) a race condition where auto-indent (in buffer.cs) and on-type-formatting (in lsp_store.rs) concurrently calculate indentation using the same buffer snapshot. Previous Solution (Abandoned): https://github.com/zed-industries/zed/pull/31340 Final Solution: Delay applying on-type-formatting until auto-indent is complete. Issue: If AutoindentMode finishes first, formatting works correctly. If "Formatting on typing" starts before AutoindentMode completes, it results in double indentation. Closes #31308 Release Notes: - Fixed a race condition resulting in incorrect buffer contents when combining auto-indent and on-type-formatting
This commit is contained in:
parent
d34d4f2ef1
commit
36eebb7ba8
5 changed files with 97 additions and 14 deletions
|
@ -1593,7 +1593,7 @@ impl FakeLanguageServer {
|
|||
T: 'static + request::Request,
|
||||
T::Params: 'static + Send,
|
||||
F: 'static + Send + FnMut(T::Params, gpui::AsyncApp) -> Fut,
|
||||
Fut: 'static + Send + Future<Output = Result<T::Result>>,
|
||||
Fut: 'static + Future<Output = Result<T::Result>>,
|
||||
{
|
||||
let (responded_tx, responded_rx) = futures::channel::mpsc::unbounded();
|
||||
self.server.remove_request_handler::<T>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue