728a874b1e2e26e52c4c6095868ecfcbfb6d5a54
Closes #22653 After some investigation, I found this bug is due to that sometimes `foreground_task` is not dispatched to the main thread unless there is user input. The current Windows implementation works as follows: when the `WindowsDispatcher` receives a `foreground_task`, it adds the task to a queue and uses `SetEvent(dispatch_event)` to notify the main thread. The main thread then listens for notifications using `MsgWaitForMultipleObjects(&[dispatch_event])`. Essentially, this is a synchronous method, but it is not robust. For example, if 100 `foreground_task`s are sent, `dispatch_event` should theoretically be triggered 100 times, and `MsgWaitForMultipleObjects(&[dispatch_event])` should receive 100 notifications, causing the main thread to execute all 100 tasks. However, in practice, some `foreground_task`s may not get a chance to execute due to certain reasons. As shown in the attached video, when I don't move the mouse, there are about 20-30 `foreground_task`s waiting in the queue to be executed. When I move the mouse, `run_foreground_tasks()` is called, which processes the tasks in the queue. https://github.com/user-attachments/assets/83cd09ca-4b17-4a1f-9a2a-5d1569b23483 To address this, this PR adopts an approach similar to `winit`. In `winit`, an invisible window is created for message passing. In this PR, we use `PostThreadMessage` to directly send messages to the main thread. With this implementation, when 100 `foreground_task`s are sent, the `WindowsDispatcher` uses `PostThreadMessageW(thread_id, RUNNABLE_DISPATCHED)` to notify the main thread. This approach enqueues 100 `RUNNABLE_DISPATCHED` messages in the main thread's message queue, ensuring that each `foreground_task` is executed as expected. The main thread continuously processes these messages, guaranteeing that all 100 tasks are executed. Release Notes: - N/A
Zed
Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Installation
On macOS and Linux you can download Zed directly or install Zed via your local package manager.
Other platforms are not yet available:
- Windows (tracking issue)
- Web (tracking issue)
Developing Zed
- Building Zed for macOS
- Building Zed for Linux
- Building Zed for Windows
- Running Collaboration Locally
Contributing
See CONTRIBUTING.md for ways you can contribute to Zed.
Also... we're hiring! Check out our jobs page for open roles.
Licensing
License information for third party dependencies must be correctly provided for CI to pass.
We use cargo-about to automatically comply with open source licenses. If CI is failing, check the following:
- Is it showing a
no license specifiederror for a crate you've created? If so, addpublish = falseunder[package]in your crate's Cargo.toml. - Is the error
failed to satisfy license requirementsfor a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to theacceptedarray inscript/licenses/zed-licenses.toml. - Is
cargo-aboutunable to find the license for a dependency? If so, add a clarification field at the end ofscript/licenses/zed-licenses.toml, as specified in the cargo-about book.
Description
GPUI – Community Edition maintained by Oak Team
https://gpui-ce.github.io/
257 MiB
Languages
Rust
95.5%
WGSL
1.2%
Metal
1.1%
HLSL
1.1%
Python
0.7%
Other
0.3%