Closes#4798
This PR implements a scrollbar for the terminal by turning
`ScrollableHandle` into a trait, allowing us to implement a custom
scroll handle, `TerminalScrollHandle`. It works by converting terminal
lines into pixels that `ScrollableHandle` understands. When
`ScrollableHandle` provides a changed offset (e.g., when you drag the
scrollbar), we convert this pixel offset back into the number of lines
to scroll and update the terminal content accordingly.
While the current version works as expected, I believe the scrollbar's
offset updates could potentially be turned into an event. This event
could then be subscribed to in `TerminalView`, not needing to update the
terminal's offset in the `render` method as it might have performance
implications. Further ideas on this are welcome.
Preview:
https://github.com/user-attachments/assets/560f0aac-4544-4007-8f0b-8833386f608f
Todo:
- [x] Experiment with custom scrollbar responding to terminal mouse
scroll
- [x] Refactor existing scrollbar handle into a trait
- [x] Update terminal to use the scrollbar trait instead of a custom
scrollbar implementation
- [x] Figure out how scrollbar events like mouse drag should notify the
terminal to update its state
- [x] Code clean up
- [x] Scrollbar hide setting for terminal
Release Notes:
- Added scrollbar to the terminal
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
* Increases width of notification message to remove a gap
* Puts the close button in the top right
Release Notes:
- N/A
Co-authored-by: Nate <nate@zed.dev>
This reverts commit 1b3b825c7f.
When debugging git diffs we found that this introduced a re-ordering of
messages sent to the LSP:
* User hits "format"
* Zed adjusts spacing, and sends "spaces changed" to the LSP
* Zed sends "format" to LSP
With the async approach here, the format request can now arrive before
the space changed request.
You can reproduce this with `test_strip_whitespace_and_format_via_lsp`
under some conditions.
Release Notes:
- N/A
- [x] Basic implementation
- [x] Disable commit buttons when committing is not possible (empty
message, no changes)
- [x] Upgrade GitSummary to efficiently figure out whether there are any
staged changes
- [x] Make CommitAll work
- [x] Surface errors with toasts
- [x] Channel shutdown
- [x] Empty commit message or no changes
- [x] Failed git operations
- [x] Fix added files no longer appearing correctly in the project panel
(GitSummary breakage)
- [x] Fix handling of commit message
Release Notes:
- N/A
---------
Co-authored-by: Nate <nate@zed.dev>
This PR restores the ability to publish the `html_to_markdown` crate
after #23291.
This crate is [published](https://crates.io/crates/html_to_markdown) to
crates.io so that it can be consumed by extensions.
Release Notes:
- N/A
This PR extracts the `PromptLibrary` out of the `assistant` crate and
moves it to the `prompt_library` crate.
The `PromptLibrary` is now decoupled from the specifics of the
`AssistantPanel` and `InlineAssistant`.
Release Notes:
- N/A
This enables having a dedicated color for the line number hover state.
That's relevant because line numbers can now be clicked to jump to
cursor location in multibuffers.
Release Notes:
- N/A
---------
Co-authored-by: João Marcos <marcospb19@hotmail.com>
This PR contains the following updates:
| Package | Type | Update | Change |
|---|---|---|---|
| [aws-config](https://redirect.github.com/smithy-lang/smithy-rs) |
dependencies | patch | `1.5.13` -> `1.5.14` |
| [aws-sdk-kinesis](https://redirect.github.com/awslabs/aws-sdk-rust) |
dependencies | minor | `1.55.0` -> `1.56.0` |
| [aws-sdk-s3](https://redirect.github.com/awslabs/aws-sdk-rust) |
dependencies | minor | `1.68.0` -> `1.69.0` |
---
### Configuration
📅 **Schedule**: Branch creation - "after 3pm on Wednesday" in timezone
America/New_York, Automerge - At any time (no schedule defined).
🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.
👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions) if
that's undesired.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box
---
Release Notes:
- N/A
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xMDcuMCIsInVwZGF0ZWRJblZlciI6IjM5LjEwNy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
A recent change in #22730 (to reduce workspace serialization) means that
a dock "forgets" its active panel whenever it is closed. When opened
again, the change in #22346 (which establishes a panel activation order)
takes effect, always opening the highest-priority panel for that dock
instead of the panel the user previously manually activated.
The result is that if you have, say, the outline panel active on the
right dock, and toggle the dock closed and then back open again, the
assistant panel will always appear instead.
This PR reverts part of the change in #22730 to ensure a dock remembers
its active panel when it is closed.
Closes#22923.
Release Notes:
- Fixed an issue where docks did not remember the active panel.
Now we ensure that task output is fully drained and printed to Zed
terminal pane on task completion.
This change depends on a recent change to alacritty_terminal crate:
5e78d20c70.
Closes https://github.com/zed-industries/zed/issues/18342
Release Notes:
- Fixed missing task terminal output on Linux for short-running commands
I’ve also updated the documentation in
`development\local-collaboration.md` and
`docs\src\development\windows.md`.
Testing collab on my Windows machine:
![屏幕截图 2025-01-14
162021](https://github.com/user-attachments/assets/28b4a36a-e156-4012-981a-5d0a23dcc613)
Release Notes:
- N/A
---------
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Closes#23216
This crash happens in the `update_visible_entries` function, where we
calculate `ancestors` and `current_ancestor_depth`. `ancestors` is map
storing information about folded ancestors and `current_ancestor_depth`
is basically selected ancestor index in reverse order of visibility.
For example, before adding a new file or directory in `a/b/c`, the
`ancestors` might look like:
```jsonc
{
"entry_id_of_c": {
"current_ancestor_depth": 2, // "a" is selected
"ancestors": ["entry_id_of_a", "entry_id_of_b", "entry_id_of_c"]
}
}
```
When new file or directory is added to`a`, ancestors length is reduced,
as `a` now is not part of folded dir due to having multiple children.
But depth still remains the same as while calculating it, we use depth
from `old_ancestors` to preserve selection across renders. This causes
panic.
```jsonc
{
"entry_id_of_c": {
"current_ancestor_depth": 2, // wrong: use of old depth here causes panic
"ancestors": ["entry_id_of_b", "entry_id_of_c"] // correct: notice "a" is missing, as "a" now has multiple children
}
}
```
This PR fixes it by capping depth so it don't exceed `ancestors` array.
This preserves existing depth as well as handles our edge case.
Release Notes:
- Fixed crash when adding a new file or directory to the first folded
directory
Closes#22885Closes#12565
This doesn't yet add history in the command palette, which is painfully
missing.
Release Notes:
- vim: Added `:!`, `:<range>!` and `:r!` support
- vim: Added `!` operator in normal/visual mode
This PR resolves one part of issue #14496
In project panel, when dragging, if you hover over a directory for
~500ms, it now auto-expands so you can drag and drop into nested
directories.
Task cleanup is handled in these cases:
- Dragged onto a different entry.
- Dragged anywhere else, and the 500ms timer runs out (for example, out
of the project panel).
- Dropped onto any entry.
I don’t see any edge cases where task isn’t cleaned up after 500ms.
https://github.com/user-attachments/assets/19da0da1-f9e2-42df-8ee4-fab6dc9a185a
Release Notes:
- Added auto-expand for directories on hover for a while during
dragging.
This PR contains the following updates:
| Package | Type | Update | Change |
|---|---|---|---|
|
[tree-sitter-css](https://redirect.github.com/tree-sitter/tree-sitter-css)
| workspace.dependencies | patch | `0.23.1` -> `0.23.2` |
---
### Release Notes
<details>
<summary>tree-sitter/tree-sitter-css (tree-sitter-css)</summary>
###
[`v0.23.2`](https://redirect.github.com/tree-sitter/tree-sitter-css/releases/tag/v0.23.2)
[Compare
Source](https://redirect.github.com/tree-sitter/tree-sitter-css/compare/v0.23.1...v0.23.2)
**NOTE:** Download `tree-sitter-css.tar.xz` for the *complete* source
code.
</details>
---
### Configuration
📅 **Schedule**: Branch creation - "after 3pm on Wednesday" in timezone
America/New_York, Automerge - At any time (no schedule defined).
🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box
---
Release Notes:
- N/A
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xMDcuMCIsInVwZGF0ZWRJblZlciI6IjM5LjEwNy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This PR extracts the streaming diff implementation to its own
`streaming_diff` crate.
It was duplicated between `assistant` and `assistant2`, but their
implementations were exactly the same (and I don't see a reason why they
would need to diverge).
Release Notes:
- N/A
To prepare for the introduction of folding in the git panel, these
codepaths need to work with the canonical source of all git status
entries, not just the ones that are visible in the panel.
Release Notes:
- N/A
---------
Co-authored-by: Nate <nate@zed.dev>
This PR adds a new `prompt_library` crate and extracts the `PromptStore`
and `PromptBuilder` to it.
Eventually we'll want to house the `PromptLibrary` itself in this crate,
but right now that involves untangling a few dependencies.
Release Notes:
- N/A
This PR moves the `SlashCommandWorkingSet` out of the `assistant` crate
and into `assistant_slash_command`.
This will unlock moving some things that depend on it out of the
`assistant` crate.
Release Notes:
- N/A
This PR makes the assistant 2 panel switch work with the keyboard via
the `cmd-e` keybinding.
Release Notes:
- N/A
---------
Co-authored-by: Agus Zubiaga <hi@aguz.me>
Makes pane::ReopenClosedItem (`cmd-shift-t` macos / `ctrl-shift-t`
linux) work in Project Panel and other non-`Pane` Dock contexts too
(Diagnostics, Outline, Git, Collab).
This PR removes the `SwitchWithLabel` component because we're adding
`label` as a method to `Switch`. Thus, we no longer need an extra
component just to append a label. Additionally, we're also adding
`keybinding` as a method.
Release Notes:
- N/A
---------
Co-authored-by: Agus Zubiaga <hi@aguz.me>