Follow-up of https://github.com/zed-industries/zed/pull/21375
When changing selections for FS entries, outline panel will be forced to
change item to the first excerpt which is not what we want.
Release Notes:
- N/A
Also scroll to the center when doing so.
This way, related editor's breadcrumbs always update, bringing more
information.
Release Notes:
- Adjust outline panel item opening behavior to always change the editor
selection, and center it
Closes https://github.com/zed-industries/zed/issues/12029
Allows to introspect project items inside items more deeply, checking
them for being dirty.
For that:
* renames `project::Item` into `project::ProjectItem`
* adds an `is_dirty(&self) -> bool` method to the renamed trait
* changes the closing logic to only care about dirty project items when
checking for save prompts conditions
* save prompts are raised only if the item is singleton without a
project path; or if the item has dirty project items that are not open
elsewhere
Release Notes:
- Fixed item closing overly triggering save dialogues
This reverts #20824 and #20899. After adding them last week we came to
the conclusion that the hints are too distracting in everyday use, see
#21128 for more details.
Release Notes:
- N/A
Co-Authored-by: Thorsten <thorsten@zed.dev>
Co-Authored-by: Antonio <antonio@zed.dev>
Screenshot:
![screenshot-2024-11-18-17 11
08@2x](https://github.com/user-attachments/assets/610fd7db-7476-4b9b-9465-a3d55df12340)
TODO:
- [x] docs
Release Notes:
- Added inline hints that guide users on how to invoke the inline
assistant and open the assistant panel. (These hints can be disabled by
setting `{"assistant": {"show_hints": false}}`.)
---------
Co-authored-by: Thorsten <thorsten@zed.dev>
Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
Came across this because I noticed that `Entry` implements `Hash`, which
was surprising to me. I believe that `ProjectEntryId` should be unique
and so it seems better to dedupe based on this.
Release Notes:
- N/A
A straight alphabetical order is arguably clearer, and avoids a large
initial delay when searching large repos.
Release Notes:
- Fixed a long initial delay when performing a project search in a large
repository.
Density tracking issue: #18078
This PR refactors our spacing system to use a more flexible and
maintainable approach. We've replaced the static `Spacing` enum with a
dynamically generated `DynamicSpacing` enum using a proc macro.
Enum variants now use a `BaseXX` format, where XX = the pixel value @
default rem size and the default UI density.
For example:
`CustomSpacing::Base16` would return 16px at the default UI scale &
density.
I'd love to find another name other than `Base` that is clear (to avoid
base_10, etc confusion), let me know if you have any ideas!
Changes:
- Introduced a new `derive_dynamic_spacing` proc macro to generate the
`DynamicSpacing` enum
- Updated all usages of `Spacing` to use the new `DynamicSpacing`
- Removed the `custom_spacing` function, mapping previous usages to
appropriate `DynamicSpacing` variants
- Improved documentation and type safety for spacing values
New usage example:
```rust
.child(
div()
.flex()
.flex_none()
.m(DynamicSpacing::Base04.px(cx))
.size(DynamicSpacing::Base16.rems(cx))
.children(icon),
)
```
vs old usage example:
```
.child(
div()
.flex()
.flex_none()
.m(Spacing::Small.px(cx))
.size(custom_spacing(px(16.)))
.children(icon),
)
```
Release Notes:
- N/A
Closes https://github.com/zed-industries/zed/issues/20187
Make outline panel more eager to open its entries:
* scroll editor to selected outline entries (before it required an extra
`"outline_panel::Open", { "change_selection": false }` action call)
* make any `Open` action call to behave like `"outline_panel::Open", {
"change_selection": true }` and remove the redundant parameter.
Now opening an entry is equal to double clicking the same entry: the
editor gets scrolled and its selection changes
* add a way to open entries the same way as excerpts are open in multi
buffers (will open the entire file, scroll and place the caret)
* additionally, fix another race issue that caused wrong entry to be
revealed after the selection change
Release Notes:
- Improved outline panel keyboard navigation
Closes https://github.com/zed-industries/zed/issues/18255
Zed does not scroll always, but only if the item is out of sight, this
is preserved for now.
Otherwise, if the item is out of sight, project and outline panels + the
syntax tree view now attempt to scroll it into the middle, if there's
enough elements above and below.
Release Notes:
- Improved revealing items for outline and project panels (now center of the list is preferred)
Move click listener to outer div
- Avoids dead area when clicking the 1px border around a list item
- Avoids flickering cursor shape when moving the cursor above the list,
and especially when scrolling the list with a stationary cursor.
Closes#15614
Release Notes:
- Fixed mouse cursor shape flickering in project and outline panels when
crossing items
([#15614](https://github.com/zed-industries/zed/issues/15614))
---------
Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
Follow-up of https://github.com/zed-industries/zed/pull/20171
Reduces time Zed needs to reach maximum search results by an order of a
magnitude.
Methodology:
* plugged-in mac with Instruments and Zed open
* Zed is restarted before each measurement, `zed` project is opened, a
*.rs file is opened and rust-analyzer is fully loaded, file is closed
then
* from an "empty" state, a `test` word is searched in the project search
* each version is checked with project panel; and then, separately,
without it
* after we reach maximum test results (the counter stops at `10191+`),
the measurement stops
Zed Dev is compiled and installed with `./script/bundle-mac -li`
------------------------
[measurements.trace.zip](https://github.com/user-attachments/files/17625516/measurements.trace.zip)
Before:
* Zed Nightly with outline panel open
<img width="1113" alt="image"
src="https://github.com/user-attachments/assets/62b29a69-c266-4d46-8c3c-0e9534ca7967">
Took over 30s to load the result set
* Zed Nightly without outline panel
<img width="1109" alt="image"
src="https://github.com/user-attachments/assets/82d8d9d6-e8f2-4e67-af55-3f54a7c1d92d">
Took over 24s to load the result set
* Zed Dev with outline panel open
<img width="1131" alt="image"
src="https://github.com/user-attachments/assets/15605ff8-0787-428e-bbb6-f8496f7e1d43">
Took around 6s to load the result set (the profile was running a bit
longer)
* Zed Dev without outline panel
<img width="1147" alt="image"
src="https://github.com/user-attachments/assets/0715d73e-f41a-4d74-a604-a3a96ad8d585">
Took around 5s to load the result set
---------------------
Improvements in the outline panel:
* https://github.com/zed-industries/zed/pull/20171 ensured we reuse
previous rendered search results from the outline panel
* all search results are now rendered in the background thread
* only the entries that are rendered with gpui are sent to the
background thread for rendering
* FS entries' update logic does nothing before the debounce now
Improvements in the editor:
* cursor update operations are debounced and all calculations start
after the debounce only
* linked edits are now debounced and all work is done after the debounce
only
Further possible improvements:
* we could batch calculations of text coordinates, related to the search
entries: right now, each search match range is expanded around and
clipped, then fitted to the closest surrounding whitespace (if any,
otherwise it's just trimmed).
Each such calculation requires multiple tree traversals, which is
suboptimal and causes more CPU usage than we could use.
* linked edits are always calculated, even if the language settings have
it disabled, or the corresponding language having no corresponding
capabilities
Release Notes:
- Improve large project search performance
This PR extracts the `render_item` implementation for outlines to the
`outline` crate to help reduce `language`'s dependence on `theme`.
Release Notes:
- N/A
This is a behavior-preserving change, but lays the groundwork for
expanding selections when the cursor lands inside of a "replace" block.
Release Notes:
- N/A
This PR ensures that we do not have to break the indent guides settings
for the project/outline panel. In the future we might want to have a
more granular way to control when to show indent guides, or control
other indent guide properties, like its width.
Release Notes:
- N/A
Also change Zed's standard style to use
`.track_focus(&self.focus_handle(cx))`, instead of
`.track_focus(&self.focus_handle)`, to catch these kinds of errors more
easily in the future.
Release Notes:
- N/A
---------
Co-authored-by: Conrad <conrad@zed.dev>
Fixes https://github.com/zed-industries/zed/issues/5291
Release Notes:
- Fixed a bug where the 'toggle comments' command didn't use the right
comment syntax in JSX and TSX elements.
---------
Co-authored-by: Conrad <conrad@zed.dev>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
We noticed that the `Workspace` was never released (along with the
`Project` and everything that comes along with that) when closing a
window.
After playing around with the LeakDetector and debugging with
`cx.on_release()` callbacks, we found two culprits: the inline assistant
and the outline panel.
Both held strong references to `View<Workspace>` after PR #16589 and PR
#16845.
This PR changes both references to `WeakView<Workspace>` which fixes the
leak but keeps the behaviour the same.
Release Notes:
- N/A
Co-authored-by: Bennet <bennet@zed.dev>
This PR adds new SVGs for the pin and unpin icons, using a custom-made
one in a smaller size, and thus removing the `PinAlt` one I added just
recently. I also tweak the outline panel pin icon button tooltip strings
a bit.
Release Notes:
- N/A
Part of https://github.com/zed-industries/zed/issues/14235
* moved search results highlight calculation into the background thread,
with highlight-less representation as a fallback
* show only a part of the line per search result, stop uniting them into
a single line if possible, always trim left trailing whitespaces
* highlight results in batches
* better cache all search result data, related to rendering
* add test infra and fix folding-related issues
* improve entry displays when multi buffer has a buffer search (find
references one has)
* fix cloud notes not showing search matches
Release Notes:
- Improved outline panel performance
Prototypes a way to display new entities in the outline panel, making it
less outline.
The design is not final and might be adjusted, but the workflow seems to
be solid enough to keep and iron it out.
* Now, when any project search buffer is activated (multi buffer mode),
or buffer search is open (singleton buffer mode, but is available for
search usages multi buffer too — in that case buffer search overrides
multi buffer's contents display), outline panel displays all search
matches instead of the outline items.
Outline items are not displayed at all during those cases, unless the
buffer search is closed, or a new buffer gets opened, of an active
buffer search matches zero items.
https://github.com/user-attachments/assets/4a3e4faa-7f75-4522-96bb-3761872c753a
* For the multi buffer mode, search matches are grouped under
directories and files, same as outline items
![Screenshot 2024-08-21 at 14 55
01](https://github.com/user-attachments/assets/6dac75e4-be4e-4338-917b-37a32c285b71)
* For buffer search , search matches are displayed one under another
![image](https://github.com/user-attachments/assets/9efcff85-d4c7-4462-9ef5-f76b08e59f20)
For both cases, the entire match line is taken and rendered, with the
hover tooltip showing the line number.
So far it does not look very bad, but I am certain there are bad cases
with long lines and bad indents where it looks not optimal — this part
most probably will be redesigned after some trial.
Or, maybe, it's ok to leave the current state if the horizontal
scrollbar is added?
Clicking the item navigates to the item's position in the editor.
Search item lines are also possible to filter with the outline panel's
filter input.
* Inline panel is now possible to "pin" to track a currently active
editor, to display outlines/search results for that editor even if
another item is activated afterwards:
![image](https://github.com/user-attachments/assets/75fb78c3-0e5f-47b4-ba3a-485c71d7e342)
This is useful in combination with project search results display: now
it's possible to leave the search results pinned in the outline panel
and jump to every search result and back.
If the item the panel was pinned to gets closed, the panel gets back to
its regular state, showing outlines/search results for a currently
active editor.
Release Notes:
- Added a way to display buffer/project search entries in the outline
panel
For future reference: WIP branch of copy/pasting a mixture of images and
text: https://github.com/zed-industries/zed/tree/copy-paste-images -
we'll come back to that one after landing this one.
Release Notes:
- You can now paste images into the Assistant Panel to include them as
context. Currently works only on Mac, and with Anthropic models. Future
support is planned for more models, operating systems, and image
clipboard operations.
---------
Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Jason <jason@zed.dev>
Co-authored-by: Kyle <kylek@zed.dev>
<img width="624" alt="image"
src="https://github.com/user-attachments/assets/f492b0bd-14c3-49e2-b2ff-dc78e52b0815">
- [x] Correctly set custom model token count
- [x] How to count tokens for Gemini models?
- [x] Feature flag zed.dev provider
- [x] Figure out how to configure custom models
- [ ] Update docs
Release Notes:
- Added support for quickly switching between multiple language model
providers in the assistant panel
---------
Co-authored-by: Antonio <antonio@zed.dev>
This is a ~small~ pure refactor that's a step toward SSH remoting. I've
extracted the Project's buffer state management into a smaller, separate
struct called `BufferStore`, currently in the same crate. I did this as
a separate PR to reduce conflicts between main and `remoting-over-ssh`.
The idea is to make use of this struct (and other smaller structs that
make up `Project`) in a dedicated, simpler `HeadlessProject` type that
we will use in the SSH server to model the remote end of a project. With
this approach, as we develop the headless project, we can avoid adding
more conditional logic to `Project` itself (which is already very
complex), and actually make `Project` a bit smaller by extracting out
helper objects.
Release Notes:
- N/A
* properly fetch outlines from channel notes and other project-less
external files
* show better messages when for no contents
* make file entries collapsible (hiding all excerpts and outlines
beneath), keep the initial panel state unfolded up to file level
Release Notes:
- Slightly improved project panel ergonomics
- Fixed issue where outline panel remains open despite being closed
before window close.
Before the release of Outline Panel feature, everything works fine. But
after that, the outline panel keeps open. It's very annoy that I only
want to edit a simple file. Event I close it before I close the window.
The active state of this panel didn't stored.
### Description:
Before the introduction of the Outline Panel feature, the application
behaved as expected. However, with the addition of the Outline Panel, an
issue arose where the panel would persistently remain open. This
behavior was observed even when manually closing the panel before
closing the application window. The problem stemmed from the inactive
state of the panel not being stored properly. This fix addresses the
issue by ensuring that the panel's active state is correctly stored and
retrieved, thereby improving user experience and preventing unnecessary
persistence of the panel's visibility.
### Screen Records
#### Before Release of Outline Panel
https://github.com/zed-industries/zed/assets/704762/2a222c70-c6d7-4472-9f27-7868d1786a5f
#### After Release of Outline Panel
https://github.com/zed-industries/zed/assets/704762/69c16a5d-beed-4d4a-8341-83c53f6a6713
#### After Fixing This Issue
https://github.com/zed-industries/zed/assets/704762/f51c5df7-54e3-4a62-ac54-b5d12cfe69d1
### Release Notes:
- Persist outline panel open state to avoid opening it on Zed startup