This PR completes the process of moving git repository state storage and
scanning logic from the worktree crate to `project::git_store`.
Release Notes:
- N/A
---------
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Conrad <conrad@zed.dev>
This is the core change:
https://github.com/zed-industries/zed/pull/26758/files#diff-044302c0d57147af17e68a0009fee3e8dcdfb4f32c27a915e70cfa80e987f765R1052
TODO:
- [x] Use AsyncFn instead of Fn() -> Future in GPUI spawn methods
- [x] Implement it in the whole app
- [x] Implement it in the debugger
- [x] Glance at the RPC crate, and see if those box future methods can
be switched over. Answer: It can't directly, as you can't make an
AsyncFn* into a trait object. There's ways around that, but they're all
more complex than just keeping the code as is.
- [ ] Fix platform specific code
Release Notes:
- N/A
In `layout_excerpt_gutter`, compute max line number length once instead
of for every row
In `max_line_number_width`, use ilog10 instead of converting to floats
and back
Release Notes:
- N/A
Follow-up of https://github.com/zed-industries/zed/pull/26410
* Extract word completions into their own, `editor::ShowWordCompletions`
action so those could be triggered independently of completions
* Assign `ctrl-shift-space` binding to this new action
* Still keep words returned along the completions as in the original PR,
but:
* Tone down regular completions' fallback logic, skip words when the
language server responds with empty list of completions, but keep on
adding words if nothing or an error were returned instead
* Adjust the defaults to wait for LSP completions infinitely
* Skip "words" with digits such as `0_usize` or `2.f32` from completion
items, unless a completion query has digits in it
Release Notes:
- N/A
This adds code to merge excerpts when you expand them and they would
overlap. It is only enabled for callers who use the
`set_excerpts_for_path` API for multibuffers (which is currently just
project diff), as other users of multibuffer care too much about the
exact excerpts that they have.
Release Notes:
- N/A
Release Notes:
- Multibuffers now use less vertical space for excerpt boundaries.
Additionally the expand up/down arrows are hidden at the start and end
of the buffers
---------
Co-authored-by: Nate Butler <iamnbutler@gmail.com>
Co-authored-by: Zed AI <claude-3.5-sonnet@zed.dev>
Closes#26541
Release Notes:
- Fixed a bug that prevented putting the cursor after a deletion hunk at
the end of a file, in the absence of trailing newlines
---------
Co-authored-by: Max <max@zed.dev>
This is motivated by trying to make the Project Diff view usable with
huge Git change sets.
Release Notes:
- Improved performance of rendering multibuffers with very large numbers
of buffers
This reduces the number of multibuffer syncs from 100,000 to 20,000.
Before this change each editor individually observed the project, so
literally any project change was amplified by the number of editors you
had open.
Now editors listen to their buffers instead of the project, and other
users of `cx.observe` on the project have been updated to use specific
events to reduce churn.
Follow up to #26237
Release Notes:
- Improved performance of Zed in large repos with lots of file system
events.
---------
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Closes https://github.com/zed-industries/zed/issues/24914 (again)
Release Notes:
- Fixed an issue where multi-line pasted content was auto-indented
incorrectly if copied from the middle of an existing line.
Closes#4271
Implemented by kicking of a task on the main thread at the end of
`Editor::handle_input` which waits for the buffer to be re-parsed before
checking if JSX tag completion possible based on the recent edits, and
if it is then it spawns a task on the background thread to generate the
edits to be auto-applied to the buffer
Release Notes:
- Added support for auto-closing of JSX tags
---------
Co-authored-by: Cole Miller <cole@zed.dev>
Co-authored-by: Max Brunsfeld <max@zed.dev>
Co-authored-by: Marshall Bowers <git@maxdeviant.com>
Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Peter Tripp <peter@zed.dev>
Release Notes:
- Git Beta: Fixed a bug where discarding a hunk in the project diff view
performed two concurrent saves of the buffer.
- Git Beta: Fixed an issue where diff hunks appeared in the wrong state
after failing to write to the git index.
This fixes a performance problem introduced in #25906 and caused by
calling `BufferDiff::snapshot` too frequently.
Release Notes:
- Fixed a performance regression related to buffer diffs
Co-authored-by: Conrad <conrad@zed.dev>
Also simplify it to avoid doing a bunch of unnecessary work.
Co-Authored-By: Cole <cole@zed.dev>
Closes #ISSUE
Release Notes:
- git: Fix jumping to the previous diff hunk
---------
Co-authored-by: Cole <cole@zed.dev>
Closes#22999
# Problem
Currently, the default soft wrap mode of an editor is determined by
reading the language-specific settings of the language _at offset zero_
in the editor's (multi)buffer. While this provides a way to pick a
single soft wrap mode for a multi-language multibuffer, it's a bad
choice for a single-buffer multibuffer that begins with a different
embedded language. For example, Markdown with frontmatter:
```markdown
---
my_front_matter
---
# Hello World
```
Setting this in config:
```json
"languages": {
"Markdown": { "soft_wrap": "bounded" }
},
```
Will not soft wrap the Markdown file as the language at offset zero is
YAML.
# Solution
Instead of using the language at offset zero, use the language of the
first buffer in the multibuffer (the buffer at offset zero). This gives
better behavior for single-buffer editors, and a similar default for
multi-language multibuffers as before.
# Testing
All existing `editor` crate tests pass, but I would appreciate any
guidance for where best to add additional testing.
Release Notes:
- Fixed soft_wrap setting not applying to buffers starting with a
different language
---------
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
This PR adds an optimistic update when staging or unstaging diff hunks.
In the process, I've also refactored the logic for staging and unstaging
hunks, to consolidate more of it in the `buffer_diff` crate.
I've also changed the way that we treat untracked files. Previously, we
maintained an empty diff for them, so as not to show unwanted
entire-file diff hunks in a regular editor. But then in the project diff
view, we had to account for this, and replace these empty diffs with
entire-file diffs. This form of state management made it more difficult
to store the pending hunks, so now we always use the same
`BufferDiff`/`BufferDiffSnapshot` for untracked files (with a single
hunk spanning the entire buffer), but we just have a special case in
regular buffers, that avoids showing that entire-file hunk.
* [x] Avoid creating a long queue of `set_index` operations when
staging/unstaging rapidly
* [x] Keep pending hunks when diff is recalculated without base text
changes
* [x] Be optimistic even when staging the single hunk in added/deleted
files
* Testing
Release Notes:
- N/A
---------
Co-authored-by: Cole Miller <m@cole-miller.net>
This PR fixes an unexpected cursor position when jumping to the
beginning of the project diff editor's first excerpt if that excerpt
starts with a deleted region. Previously, the cursor would end up in the
*following* region in this situation; now it ends up at the start of the
deleted region, as happens already for excerpts that are not the first.
Release Notes:
- N/A
---------
Co-authored-by: Max <max@zed.dev>
Like the real app, this one infinite loops if you have a diff in an
UnsharedFile.
Release Notes:
- N/A *or* Added/Fixed/Improved ...
---------
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Release Notes:
- Fixed gutter highlights not matching diff hunks in multibuffers in
some cases
---------
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Closes#25513
This PR handles case when `editor::SelectLargerSyntaxNode` expands
across excerpt boundaries and eventually crashes in multi buffer.
Release Notes:
- Fixed panic caused when `editor::SelectLargerSyntaxNode` is called
repetedly in multi buffer.
Co-authored-by: Ben Kunkle <ben.kunkle@gmail.com>
Closes: #25475
This PR makes it possible to stage uncommitted hunks that overlap but do
not coincide with an unstaged hunk.
Release Notes:
- Made it possible to stage hunks that are already partially staged
---------
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Max <max@zed.dev>
Give the inline file crease inside of `assistant2`'s editor a
selection background when there is a selection over it
Release Notes:
- N/A
---------
Co-authored-by: Piotr <piotr@zed.dev>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Closes#12064
It feels a bit strange to use `brackets` for this but it seems to work
without unintended consequences from my testing so far.
Release Notes:
- N/A
---------
Co-authored-by: Marshall Bowers <git@maxdeviant.com>
This reverts commit 9ef0501853 due to a
panic.
```
{
"thread": "main",
"payload": "9 is not a valid char boundary in path \"crates/…/LiveKitBridge/\"",
"location_data": {
"file": "crates/file_finder/src/file_finder.rs",
"line": 646
}
}
```
Release Notes:
- N/A
Done automatically with
> ast-grep -p '$A.background_executor().spawn($B)' -r
'$A.background_spawn($B)' --update-all --globs "\!crates/gpui"
Followed by:
* `cargo fmt`
* Unexpected need to remove some trailing whitespace.
* Manually adding imports of `gpui::{AppContext as _}` which provides
`background_spawn`
* Added `AppContext as _` to existing use of `AppContext`
Release Notes:
- N/A
This PR makes progress on #7711 by identifying any common prefix of the
paths in the file finder's search results, and replacing the "interior"
of that prefix---every path segment but the first and last---with `...`,
when a heuristic indicates that the longest path would otherwise
overflow the modal.
The elision is not applied to any segment that contains a match for the
search query.
There may be more work to do on #7711 in the case of long result paths
that do not share a significant common prefix.
Release Notes:
- Improved display of long paths in the file finder modal
Co-authored-by: Max <max@zed.dev>