We were effectively discarding value set by display_nav_history_buttons
once we've updated settings for a pane. This commit adds another bit of
state to display_nav_history_buttons by allowing it to hard-deny setting
updates.
Release Notes:
- Fixed a bug that caused disabled navigation buttons to show up in
terminal panel.
This fixes#9811 by checking for the `solargraph` binary in the `$PATH`
as it's setup in the project shell.
It also adds support for configuring the path to `solargraph` manually:
```json
{
"lsp": {
"solargraph": {
"binary": {
"path": "/Users/thorstenball/bin/solargraph",
"arguments": ["stdio"]
}
}
}
}
```
## Example
Given the following setup:
- `ruby@3.3.0` used globally, no `solargraph` installed globally
- `ruby@3.2.2` used in a project, `solargraph` installed as binstub in
`$project/bin/solargraph`, `.envrc` to configure `direnv` to add
`$project/bin` to `$PATH
Which looks like this in practice:
```shell
# GLOBAL
~ $ ruby --version
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
~ $ which solargraph
solargraph not found
# IN PROJECT
~ $ cd work/projs/rails-proj
direnv: loading ~/work/projs/rails-proj/.envrc
direnv: export ~PATH
~/work/projs/rails-proj $ ruby --version
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin23]
~/work/projs/rails-proj $ which solargraph
/Users/thorstenball/work/projs/rails-proj/bin/solargraph
```
The expectation is that Zed, when opening `~/work/projs/rails-proj`,
picks up the local `solargraph`.
But with **Zed Stable** that doesn't work, as we can see in the logs:
```
2024-04-22T10:21:37+02:00 [INFO] starting language server. binary path: "solargraph", working directory: "/Users/thorstenball/work/projs/rails-proj", args: ["stdio"]
2024-04-22T10:21:37+02:00 [ERROR] failed to start language server "solargraph": No such file or directory (os error 2)
```
With the change in this PR, it uses `rails/proj/bin/solargraph`:
```
[2024-04-22T10:33:06+02:00 INFO language] found user-installed language server for Ruby. path: "/Users/thorstenball/work/projs/rails-proj/bin/solargraph", arguments: ["stdio"]
[2024-04-22T10:33:06+02:00 INFO lsp] starting language server. binary path: "/Users/thorstenball/work/projs/rails-proj/bin/solargraph", working directory: "/Users/thorstenball/work/projs/rails-proj", args: ["stdio"]
```
**NOTE**: depending on whether `mise` (or `rbenv`, `asdf`, `chruby`,
...) or `direnv` come first in the shell-rc file, it picks one or the
other, depending on what puts itself first in `$PATH`.
## Release Notes
Release Notes:
- Added support for finding the Ruby language server `solargraph` in the
user's `$PATH` as it is when `cd`ing into a project's directory.
([#9811](https://github.com/zed-industries/zed/issues/9811))
- Added support for configuring the `path` and `arguments` for
`solargraph` language server manually. Example from settings: `{"lsp":
{"solargraph": {"binary":
{"path":"/Users/thorstenball/bin/solargraph","arguments": ["stdio"]}}}}`
([#9811](https://github.com/zed-industries/zed/issues/9811))
Reverts zed-industries/zed#10695
Some users are experiencing broken scrolling due to the changes from
this PR, so it should be reverted while I investigate what causes the
problems.
Release Notes:
- N/A
This PR adds an action to expand the excerpts lines of context in a
multibuffer.
Release Notes:
- Added an `editor::ExpandExcerpts` action (bound to `shift-enter` by
default), which can expand the excerpt the cursor is currently in by 3
lines. You can customize the number of lines by rebinding this action
like so:
```json5
// In your keybindings array...
{
"context": "Editor && mode == full",
"bindings": {
"shift-enter": ["editor::ExpandExcerpts", { "lines": 5 }],
}
}
```
---------
Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Max <max@zed.dev>
Editor scrollbar has several issues that show up on large files:
- The thumb scrolls beyond the window.
- When dragged, the thumb goes out of sync with the mouse pointer.
- When the scrollbar trunk is clicked, the thumb jumps incorrectly.
https://github.com/zed-industries/zed/assets/2101250/320dba59-a526-4e68-99b3-1186271ba839
The reason is that the scrollbar now has two modes:
1. The "basic mode" for small files, when the thumb height correctly
represents the visible area, i.e. the top of the thumb matches the top
visible row (let's call it top-to-top sync), and the bottom of the thumb
matches the bottom visible row.
2. The "extended mode" for large files, when thumb becomes too small and
we have to impose minimal height to it. In this mode we have a vertical
offset of the first row position inside the scrollbar, we try to
position the thumb center-to-center with the editor.
...and the second mode is not implemented correctly. Also, mouse event
handlers ignore it. It is possible to fix this implementation, but I'm
not sure if it worth doing because it a) leads to some confusing cases
(for instance, in the extended mode the first row marker is not at the
top of the scrollbar), and b) differs from what all other editors do.
Here's a previous mentioning of this problem:
https://github.com/zed-industries/zed/pull/9080#pullrequestreview-1927465293
This PR changes the "extended mode", making it synchronize the thumb
top-to-top with the editor. It solves all the mentioned problems and
makes the scroll thumb work the same whay as in other editors.
But if you want to stick to the idea of the center-to-center sync for
large files, I can do that too.
Release Notes:
- Fixed scroll thumb behaviour.
Optionally, include screenshots / media showcasing your addition that
can be included in the release notes.
- N/A
~~This is extracted from #10643.~~
~~It looks like the editor had a small optimization to drop events when
hovering the gutter. This also happens while dragging a tab over the
gutter, and causes some stuttering. Please correct me if this wasn't
just a small optimization, but I could not derive a different reason for
this code to exist.~~
The window was waiting for event propagation to update any drag. This
change makes sure the drag always gets updated, which makes sure it will
always be fluid, no matter if any element stops event propagation. Ty
@as-cii for pointing me to a better solution!
Release Notes:
- Fixed issue where dragging tab over any element that stops event
propagation would stutter
Changes the X11 platform code to use the xinput extension which allows
for smooth scrolling and horizontal scrolling.
Release Notes:
- Added smooth scrolling to X11 on Linux
- Added horizontal scrolling to X11 on Linux
This introduces multiple improvements to the drop targets.
## Hitbox shape
Currently, hitboxes are rectangles, where the vertical ones reach all
the way to the ends, which reduces the space for the horizontal ones,
making the hitboxes a bit awkward in the corners. This new approach just
determines the closest side.
Visual representation:
![Frame
3](https://github.com/zed-industries/zed/assets/1282767/1cd2ca31-d9d4-41dd-87fb-1a8fbb8b7fcc)
## Hitbox size
The width of the hitbox was currently always 8 rem all around. In setups
with many columns or rows, or when the font size was very large, this
could potentially overlap the center hitbox, not allowing to drop a tab
without another split. Now the width of the hitboxes are a fraction of
the smaller size of its parents width and height. This makes sure the
hitboxes have the same width all around, but never fully block the
center hitbox.
I've also made this value configurable through the new
`drop_target_size` config which takes a `f32` fraction and is set to 0.2
by default.
Not sure if this is worth mentioning, but this technically allows to
remove the split hitboxes all together by setting it to `0.0`, or
removing the center hitbox by setting it to any value `>=0.5`. Not that
this is necessary, but it would be possible now.
## Larger visualization
The visual overlay when using one of the side hitboxes were also `8em`
wide. Since their logical size now changed, and it can't currently be
represented with GPUI (without abusing the `canvas` element), I made the
visual feedback take half of the width or height of the available space,
just like how other editors do this.
Also, the opacity/alpha value set by a theme is currently ignored. This
change now respects the themes opacity for it!
## Respect alpha value
Currently, the alpha value of `drop_target.background` is ignored. Even
the default themes set a value that is overwritten by a hard coded
value. I have removed this hard coded value and it now respects the
alpha value.
This change affects existing themes, see
https://github.com/zed-industries/zed/pull/10643#issuecomment-2059641528
## ~~No more lag while dragging over gutter~~ Extracted into #10737
~~It looks like the editor had a small optimization to drop events when
hovering the gutter. This also happens while dragging a tab over the
gutter, and causes some stuttering. Please correct me if this wasn't
just a small optimization, but I could not derive a different reason for
this code to exist.~~
Here is a video that tries to show all those changes with a before on
the left, and the after on the right:
https://github.com/zed-industries/zed/assets/1282767/f97f3420-513f-410f-a1c8-7966429ad348
Release Notes:
- Added `drop_target_size` setting. This should be a fractional percent
(e.g., `0.5`).
- Improved the hitboxes for drop targets.
- Updated drop targets to respect the alpha channel of the
`drop_target.background` color.
### What?
A setting has been added to control the visibility of the Project Panel
button in the status bar.
### Why?
I don't tend to use the Project Panel, but use a keyboard shortcut to
access if needed. Thus, the button in the status bar provides me little
more than visual clutter. Additionally, there is precedent for this
configurability with other panels (collaboration, chat, notification,
terminal, etc).
Release Notes:
- Added a setting to show/hide the Project Panel button in the status
bar. `{"project_panel": {"button": false}}`
By default NSWindow's release themselves when closed, which doesn't
interact well with rust's lifetime system.
Disable that behaviour, and explicitly release the NSWindow when the
window handle is dropped.
Release Notes:
- Fixed a (rare) panic when closing a window.
This relaxes path parsing to allow paths like ./foo.rs:food or
./food/foo_bar.rs:2:12:food as some tools may add a suffix without
regard for col/row end.
Fixes#10688
Release Notes:
- Made path parsing in terminal (for directory links) more lenient with
regards to row/column fields.
This fixes useless error messages popping up in case a file hasn't been
committed yet or the repo doesn't have commits yet.
Release Notes:
- Fixed git blame functionality not handling errors correctly when there
are no commits yet or when file isn't committed yet.
With file icons turned off, we still reserve space for an icon and make
it invisible. However, that space was marked as flex, which made it
shrink in case subsequent file name could not fit in the current width
of the project panel. Fixes#10622https://github.com/zed-industries/zed/assets/24362066/d565a03a-3712-49d1-bf52-407e4508a8cf
Release Notes:
- Fixed project panel entries misalignment with narrow panel & file
icons turned off.
Fixes
https://github.com/zed-industries/zed/pull/9754#pullrequestreview-2005401133
Fixes
https://github.com/zed-industries/zed/pull/9754#issuecomment-2060536590
Closes https://github.com/zed-industries/zed/pull/10669
* Updates the docs to use a proper max value for the centered layout
padding (0.4 instead of 0.45)
* Makes the `center` wrapper (`h_flex`) to be of size of the `center`
element always, to ensure terminal lines are displayed correctly
The letter fix is somewhat hacky: while it does the right thing right
now, it does not prevent us from future mistakes like these, and does
not explain why the bottom dock could be of one, smaller, height, and
its contents, the terminal pane/terminal element/something else would
think that it has a larger height, thus breaking the scrolling and
rendering.
cc @alygin if you're interested to solve another layout-related thing.
Release Notes:
- N/A
This PR adds an editor controls menu to the tool bar. This menu will be
used to contain controls that toggle visual features in the editor, like
toggling inlay hints, showing git status or blame, hiding the gutter,
hiding or showing elements in the tool bar, etc.
For the moment, this consolidates the new Inline Git Blame toggle and
the old Inlay Hints toggle. In the future it will contain additional
controls.
Before:
![CleanShot - 2024-04-16 at 16 38
53@2x](https://github.com/zed-industries/zed/assets/1714999/249e353f-786a-4391-8d49-66dd61feff8a)
After:
![CleanShot - 2024-04-16 at 16 38
43@2x](https://github.com/zed-industries/zed/assets/1714999/5b3cf4d5-855a-4475-ac05-8474b6c94b7b)
---
Release Notes:
- Added an editor controls menu to the tool bar. This will contain
visual, editor-specific options like toggling inlay hints, showing git
status or blame, etc.
- Removed the top level inlay hint toggle from the tool bar due to the
above change.
- Added the ability to toggle inline git blame from the new editor
controls menu.
---------
Co-authored-by: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
This PR implements the Centered Layout feature (#4685):
- Added the `toggle centered layout` action.
- The centered layout mode only takes effect when there's a single
central pane.
- The state of the centered layout toggle is saved / restored between
Zed restarts.
- The paddings are controlled by the `centered_layout` setting:
```json
"centered_layout": {
"left_padding": 0.2,
"right_padding": 0.2
}
```
This allows us to support both the VSCode-style (equal paddings) and
IntelliJ-style (only left padding in Zen mode).
Release Notes:
- Added support for Centered Layout
([#4685](https://github.com/zed-industries/zed/pull/9754)).
https://github.com/zed-industries/zed/assets/2101250/2d5b2a16-c248-48b5-9e8c-6f1219619398
Related Issues:
- Part of #4382
This uses the language server settings added in #9293 to allow users to
specify the binary path and arguments with which to start up `clangd`.
Example user settings for `clangd`:
```json
{
"lsp": {
"clangd": {
"binary": {
"path": "/usr/bin/clangd",
"arguments": ["--log=verbose"]
},
}
}
}
```
Constraints:
* Right now this only allows ABSOLUTE paths.
Release Notes:
- Added ability to specify `clangd` binary `path` (must be absolute) and
`arguments` in user settings. Example: `{"lsp": {"clangd": {"binary":
{"path": "/usr/bin/clangd", "arguments": ["--log=verbose"] }}}}`
Fixes https://github.com/zed-industries/zed/issues/10611
Zed has `workspace::NewSearch` (without a default keybinding) and
`workspace::DeploySearch` (with the default keybinding for its
`DeploySearch::find()` form).
Use the one with the keybinding, as it's the whole point of the menu.
Release Notes:
- Fixed "Find In Project" app menu item having no keybinding
([10611](https://github.com/zed-industries/zed/issues/10611))
We were previously not conforming to LSP spec, as we were setting
**both** result field and error field on response fields, which could
confuse servers. Excerpt from the spec:
> * The result of a request. This member is REQUIRED on success.
> * This member MUST NOT exist if there was an error invoking the
method.
Fixes#10595
Release Notes:
- N/A
Some code blocks that are returned in tooltips (returned by language
servers, for example) use the language file extension as the language in
the the triple-backtick code blocks.
Example:
```rs
fn rust_code() {}
```
```cpp
fn rust_code() {}
```
Before this change we only looked up the language with the
`rs`/`cpp`/... being interpreted as the language name. Now we also treat
it as a possible file extension.
Release Notes:
- Fixed Markdown code blocks in tooltips not having correct language
highlighting.
Before:
![image](https://github.com/zed-industries/zed/assets/1185253/1f3870a6-467c-4e5f-9e49-1ff32240d10f)
After:
![screenshot-2024-04-16-12 43
39@2x](https://github.com/zed-industries/zed/assets/1185253/21a45ed5-825a-412d-9dc0-35a444fc64ba)
Co-authored-by: Bennet <bennetbo@gmx.de>
This fixes#10511 by turning off the YAML metadata block rendering in
the Markdown parser.
`clangd` uses `---` as dividers, but our parser interpreted it as a YAML
metadata block, even though it didn't contain any valid YAML.
Example Markdown from `clangd`:
### instance-method `format`
---
→ `void`
Parameters:
- `const int &`
- `const std::tm &`
- `int & dest`
---
```cpp
// In my_formatter_flag
public: void format(const int &, const std::tm &, int &dest)
```
What's between the two `---` is *not* valid YAML. Neovim, too,
interprets these as dividers and renders them as such.
And since we don't handle any possible metadata anyway, we can turn off
the metadata handling, which causes the parser to interpret the `---` as
dividers.
Release Notes:
- Fixed Markdown returned by `clangd` being rendered the wrong way.
([#10511](https://github.com/zed-industries/zed/issues/10511)).
Before:
![screenshot-2024-04-16-12 32
15@2x](https://github.com/zed-industries/zed/assets/1185253/a268f106-9504-48aa-9744-42a7521de807)
After:
![screenshot-2024-04-16-12 33
02@2x](https://github.com/zed-industries/zed/assets/1185253/dd178a63-a075-48a9-85d9-565157a5b050)
Co-authored-by: Bennet <bennetbo@gmx.de>
Release Notes:
- Added a setting to show/hide the terminal button in the status bar:
`{"terminal": {"button": false}}` to hide it. (#10513)
---------
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
Zed displays scrollbar markers of three types: git diffs, background
highlights and diagnostics. At the moment, the "background highlights"
markers are displayed for all the supported highlights:
- Occurences of the symbol under cursor.
- Search results.
- Scope boundaries (only works when a symbol is selected).
- Active hover popover position.
They all use the same color, which leads to confusing results. For
instance, in the following case I expect to see markers for the
`new_anchor` occurences in lines 43 and 47. But besides them, there're
also scope-markers for `ScrollAnchor` initialization block in lines 46
and 49, which makes me think that there're four places where
`new_anchor` appears.
<img width="740" alt="zed-scrollbar-markers"
src="https://github.com/zed-industries/zed/assets/2101250/78700e6b-fdd1-4c2f-beff-e564d8defc13">
Existing settings `selection` and `symbol_selection` in the `scrollbar`
section [don't work as
expected](https://github.com/zed-industries/zed/pull/10080#discussion_r1552325493),
which increases confusion.
This PR only leaves two types of bg-highlight-markers and provides
dedicated settings for them:
- Occurences of the symbol under cursor. Setting: `selected_symbol`,
default is `true`.
- Search results. Setting: `search_results`, default is `true`.
The `selection` and `symbol_selection` settings are not used anymore.
Release Notes:
- Breaking changes. Settings `selection` and `symbol_selection` in the
`scrollbar` section renamed to `search_results` and `selected_symbol`
respectively. Fixed the effect of these settings on which markers are
displayed on the scrollbar.
Optionally, include screenshots / media showcasing your addition that
can be included in the release notes.
- N/A
/cc @mrnugget
This moves the diagnostics and find all references to be in line with
the search pane. This also centralizes the constant into the editor code
base.
Release Notes:
- Increased diagnostic context to match the project search context.
This PR updates the extension list to disable remote entries when the
corresponding dev extension is installed.
Here is what this looks like:
<img width="1189" alt="Screenshot 2024-04-15 at 4 09 45 PM"
src="https://github.com/zed-industries/zed/assets/1486634/48bb61d4-bc85-4ca6-b233-716831dfa7d8">
Release Notes:
- Disabled extension entries when there is a development copy of that
extension installed.
Fixes the cursor not updating when (a) switching windows from another
program via a shortcut and (b) when cursor updates were triggered by
something other than moving the mouse (e.g. when scrolling or pressing a
key).
Release Notes:
- N/A
This PR makes it so clicking "Install" will install the latest
compatible version of an extension instead of disabling the button when
the latest version is not compatible.
The "Upgrade" button will still be disabled when the latest version is
not compatible. We will also now display a tooltip to better indicate
why the button is disabled:
<img width="607" alt="Screenshot 2024-04-15 at 2 41 26 PM"
src="https://github.com/zed-industries/zed/assets/1486634/16ad516e-1c0c-4505-b994-158ea655641b">
Related to https://github.com/zed-industries/zed/issues/10509.
Release Notes:
- Changed the "Install" button for extensions to always install the
latest compatible version instead of becoming disabled when the latest
version of an extension is incompatible with the current Zed version.
This PR adds an indicator to show what extension version is currently
installed when on an extension version that is not the latest.
<img width="1156" alt="Screenshot 2024-04-15 at 2 10 33 PM"
src="https://github.com/zed-industries/zed/assets/1486634/61c5e4cf-a0b8-48fc-8e52-f04f1c351794">
Release Notes:
- Added an indicator to show the currently-installed extension version
when not on the latest version.
This fixes an issue that could cause `from_iter` to never finish if the
underlying iterator restarted after returning `None` for the first time.
We only saw this in development but I wanna cherry-pick it to stable and
preview, just in case.
Release Notes:
- N/A
Co-authored-by: Kyle <kylek@zed.dev>
This fixes when the workspace is not actually available for a
`.read(cx)`.
Release Notes:
- Fix a panic when quoting a selection before the assistant panel has
been started
Co-authored-by: Conrad Irwin <conrad@zed.dev>
This PR fixes a bug where the constraints provided when downloading the
latest version of an extension were not being read properly.
These constraints are passed in the query string, but `collab` was
attempting to read them from the path.
This should fix https://github.com/zed-industries/zed/issues/10484, once
it is deployed.
Release Notes:
- N/A
Here comes a lenghty explanation for a short commit: We've had feedback
that our diagnostics tab often mismatches what's shown in the status
bar. E.g: https://x.com/fasterthanlime/status/1778764747732594753 Let's
dive into the lifetime of diagnostic tab first; it is actually spawned
*just once per workspace*, the first time you click on the diagnostics
status indicator. Even if you close this tab, we still reuse the same
object under the hood later on. This has upsides, as it means that you
can close a tab and then reopen it with your selections still in-tact
and so on. However, this also leads to the perceived staleness.
Crucially, the first time ever in a given session that you spawn the
diagnostics tab, the status bar counts match the content of a tab. That
is because we always call \`update_excerpts\` when we create diagnostics
tab for the first time, but later on we have severe constraints on when
we want to update the excerpts in diagnostics tab, mostly centered
around presence of selections in an editor... but, since we reuse the
diagnostic tab object under the hood, we're always gonna have at least
one selection in an editor sans the first time you open it. The end
result is that in order for diagnostic tab contents to be updated, we
have to get a "on-disk-diagnostics-finished" notification from language
server, which can take a long time.
Another example of this property manifesting itself is that if you fix a
diagnostic warning/error, it takes a while for diagnostic tab to reflect
it.
With this PR, I've afforded a bit of leniency in refreshing the contents
of that tab. The old check that discarded updates when diagnostics
editor had at least one selection has been updated to instead reject
multicursors; this is still overly conservative, as I'm not yet sure how
big of an issue is the cursor that's jumping around (as that's what the
selections constraint is supposed to prevent).
Release Notes:
- Fixed diagnostics tab showing outdated entries before the language
server is done with it's analysis.
This fixes a bug that caused the editor to be rendered incorrectly when
its bounds extended outside the content mask. This is because the editor
uses the returned `Hitbox` bounds to determine the origin of its
elements.
With this commit, we will now store a new `content_mask` field within
the `Hitbox` struct which is captured when the hitbox is inserted. Then,
the content mask is applied on the fly when performing a hit test to
determine whether the hitbox is actually hovered.
Release Notes:
- N/A
Part of https://github.com/zed-industries/zed/issues/5141
* adds "run selection" and "run file" tasks for bash and Python.
* replaces newlines with `\n` symbols in the human-readable task labels
* properly escapes task command arguments when spawning the task in
terminal
Caveats:
* bash tasks will always use user's default shell to spawn the
selections, but they should rather respect the shebang line even if it's
not selected
* Python tasks will always use `python3` to spawn its tasks now, as
there's no proper mechanism in Zed to deal with different Python
executables
Release Notes:
- Added tasks for bash and Python to execute selections and open files
in terminal
Some people (like myself) use touchpads for development and I find Zed's
default scroll sensitivity to be slower than I like. This change adds a
scroll sensitivity multiplier that allows users to customize the speed
of their scrolling.
Release Notes:
- Added a setting under "scroll_sensitivity" that allows user to control
the scroll sensitivity. This value acts as a multiplier for the
horizontal and vertical scroll speed.
This adds so-called "inline git blame" to the editor that, when turned
on, shows `git blame` information about the current line inline:
![screenshot-2024-04-15-11 29
35@2x](https://github.com/zed-industries/zed/assets/1185253/21cef7be-3283-4556-a9f0-cc349c4e1d75)
When the inline information is hovered, a new tooltip appears that
contains more information on the current commit:
![screenshot-2024-04-15-11 28
24@2x](https://github.com/zed-industries/zed/assets/1185253/ee128460-f6a2-48c2-a70d-e03ff90a737f)
The commit message in this tooltip is rendered as Markdown, is
scrollable and clickable.
The tooltip is now also the tooltip used in the gutter:
![screenshot-2024-04-15-11 28
51@2x](https://github.com/zed-industries/zed/assets/1185253/42be3d63-91d0-4936-8183-570e024beabe)
## Settings
1. The inline git blame information can be turned on and off via
settings:
```json
{
"git": {
"inline_blame": {
"enabled": true
}
}
}
```
2. Optionally, a delay can be configured. When a delay is set, the
inline blame information will only show up `x milliseconds` after a
cursor movement:
```json
{
"git": {
"inline_blame": {
"enabled": true,
"delay_ms": 600
}
}
}
```
3. It can also be turned on/off for the current buffer with `editor:
toggle git blame inline`.
## To be done in follow-up PRs
- [ ] Add link to pull request in tooltip
- [ ] Add avatars of users if possible
## Release notes
Release Notes:
- Added inline `git blame` information the editor. It can be turned on
in the settings with `{"git": { "inline_blame": "on" } }` for every
buffer or, temporarily for the current buffer, with `editor: toggle git
blame inline`.
Before, `tasks_ui` set most of the context with `SymbolContextProvider`
providing the symbol data part of the context. Now, there's a
`BasicContextProvider` that forms all standard Zed context and it
automatically serves as a base, with no need for other providers like
`RustContextProvider` to call it as before.
Also, stop adding `SelectedText` task variable into the context for
blank text selection.
Release Notes:
- N/A
This PR adjusts our scrolling implementation to delay the generation of
ScrollWheel events until we receive a complete frame.
Note that our implementation is still a bit off-spec, as we don't delay
any other kind of events. But it's been working so far on a variety of
compositors and the other events contain complete data; so I'll hold off
on that refactor for now.
Release Notes:
- N/A
https://crates.io/crates/block implies this is necessary, and we're
still seeing segfaults in this method, so...
Release Notes:
- Fixed a panic when installing the CLI / registering for the zed://
protocol
A subsequent update introduced the `HMONITOR` value to the
`WindowsDisplay` struct, eliminating the need for polling to retrieve
this value.
Release Notes:
- N/A
Currently, terminal will emit resize event every seconds, even if the
size not changed.
this PR fixed only emit resize event when size is changed.
Release Notes:
- N/A
This PR extracts Vue support into an extension and removes the built-in
C# support from Zed.
Release Notes:
- Removed built-in support for Vue, in favor of making it available as
an extension. The Vue extension will be suggested for download when you
open a `.vue` file.
---------
Co-authored-by: Max <max@zed.dev>
Fixed auto folded dirs which caused significant performance issues #8476
(#7674)
Moved from iterating over snapshot entries to use `child_entries`
function from `worktree.rs` by making it public
@maxbrunsfeld
Release Notes:
- Fixed a bug where project panel settings changes would not be applied
immediately.
- Added a `project_panel.auto_fold_dirs` setting which collapses the
nesting in the project panel when there is a chain of folders containing
a single folder.
<img width="288" alt="Screenshot 2024-04-12 at 11 10 58 AM"
src="https://github.com/zed-industries/zed/assets/2280405/efd61e75-026c-464d-ba4d-90db5f68bad3">
---------
Co-authored-by: Mikayla <mikayla@zed.dev>
This introduces semantic indexing in Zed based on chunking text from
files in the developer's workspace and creating vector embeddings using
an embedding model. As part of this, we've created an embeddings
provider trait that allows us to work with OpenAI, a local Ollama model,
or a Zed hosted embedding.
The semantic index is built by breaking down text for known
(programming) languages into manageable chunks that are smaller than the
max token size. Each chunk is then fed to a language model to create a
high dimensional vector which is then normalized to a unit vector to
allow fast comparison with other vectors with a simple dot product.
Alongside the vector, we store the path of the file and the range within
the document where the vector was sourced from.
Zed will soon grok contextual similarity across different text snippets,
allowing for natural language search beyond keyword matching. This is
being put together both for human-based search as well as providing
results to Large Language Models to allow them to refine how they help
developers.
Remaining todo:
* [x] Change `provider` to `model` within the zed hosted embeddings
database (as its currently a combo of the provider and the model in one
name)
Release Notes:
- N/A
---------
Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Conrad Irwin <conrad@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Co-authored-by: Antonio <antonio@zed.dev>
This reverts commit caed275fbf.
NOTE: this should not be merged until #9668 is on stable and the
`ZedVersion#can_collaborate` is updated to exclude all clients without
that change.
Release Notes:
- N/A
---------
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
This PR extracts Terraform support into an extension and removes the
built-in Terraform support from Zed.
Release Notes:
- Removed built-in support for Terraform, in favor of making it
available as
an extension. The Terraform extension will be suggested for download
when you
open a `.tf`, `.tfvars`, or `.hcl` file.
`FindAllReferences` will now open a preview tab, jumping to a definition
will also open a preview tab.
https://github.com/zed-industries/zed/assets/53836821/fa3db1fd-ccb3-4559-b3d2-b1fe57f86481
Note: One thing I would like to improve here is also adding support for
reopening `FindAllReferences` using the navigation history. As of now
the navigation history is lacking support for reopening items other then
project files, which needs to be implemented first.
Release Notes:
- N/A
There was an edge case where the project panel selection would not be
updated when opening a lot of tabs quickly using the preview tab
feature.
I spent way too long debugging this, thankfully @ConradIrwin spotted it
in like 5 minutes 🎉
Release Notes:
- N/A
Although I liked the symmetry of the count in the middle of the arrows,
it's
tricky to make the buttons not occlude the count on hover, so go back to
this arrangement.
Release Notes:
- N/A
For example:
```
"alt-t": [
"task::Rerun",
{ "reevaluate_context": true, "allow_concurrent_runs": true }
],
```
Overriding `allow_concurrent_runs` to `true` by itself should terminate
current instance of the task, if there's any.
This PR also fixes task deduplication in terminal panel to use expanded
label and not the id, which depends on task context. It kinda aligns
with how task rerun worked prior to #10341 . That's omitted in the
release notes though, as it's not in Preview yet.
Release Notes:
- `Task::Rerun` action can now override `allow_concurrent_runs` and
`use_new_terminal` properties of the task that is being reran.
This introduces a new API on `StatefulInteractiveElement` to create a
tooltip that can be hovered, scrolled inside, and clicked:
`.hoverable_tooltip`.
Right now we only use it in the `git blame` gutter, but the plan is to
use the new hover/click/scroll behavior in #10398 to introduce new
git-blame-tooltips.
Release Notes:
- N/A
---------
Co-authored-by: Antonio <antonio@zed.dev>
<img width="1035" alt="Screenshot 2024-04-11 at 13 13 44"
src="https://github.com/zed-industries/zed/assets/13402668/cd0e96a0-41c6-4757-8840-97d15a75c511">
Release Notes:
- Added a notification to show possible `git blame` errors if it fails to run.
Caveats:
- ~git blame now executes in foreground
executor (required since the Fut is !Send)~
TODOs:
- After a failed toggle, the app thinks the blame
is shown. This means toggling again will do nothing
instead of retrying. (Caused by editor.show_git_blame
being set to true before the git blame is generated)
- ~(Maybe) Trim error?~ Done
---------
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
Release Notes:
- Added the current operator stack to the Vim status bar at the bottom
of the editor. #4447
This commit introduces a new feature that displays the current partial
command in the vim mode, similar to the behavior in Vim plugin. This
helps users keep track of the commands they're entering.
With the recent Linux rewrite, I attempted to simplify the number of
wrapper structs involved in the Linux code, following the macOS code as
an example. Unfortunately, I missed a vital component: pointers to the
platform state, held by platform data structures. As we hold all of the
platform data structures on Linux, this PR reintroduces a wrapper around
the internal state of both the platform and the window. This allows us
to close and drop windows correctly.
This PR also fixes a performance problem introduced by:
https://github.com/zed-industries/zed/pull/10343, where each configure
request would add a new frame callback quickly saturating the main
thread and slowing everything down.
Release Notes:
- N/A
This PR implements the preview tabs feature from VSCode.
More details and thanks for the head start of the implementation here
#6782.
Here is what I have observed from using the vscode implementation ([x]
-> already implemented):
- [x] Single click on project file opens tab as preview
- [x] Double click on item in project panel opens tab as permanent
- [x] Double click on the tab makes it permanent
- [x] Navigating away from the tab makes the tab permanent and the new
tab is shown as preview (e.g. GoToReference)
- [x] Existing preview tab is reused when opening a new tab
- [x] Dragging tab to the same/another panel makes the tab permanent
- [x] Opening a tab from the file finder makes the tab permanent
- [x] Editing a preview tab will make the tab permanent
- [x] Using the space key in the project panel opens the tab as preview
- [x] Handle navigation history correctly (restore a preview tab as
preview as well)
- [x] Restore preview tabs after restarting
- [x] Support opening files from file finder in preview mode (vscode:
"Enable Preview From Quick Open")
I need to do some more testing of the vscode implementation, there might
be other behaviors/workflows which im not aware of that open an item as
preview/make them permanent.
Showcase:
https://github.com/zed-industries/zed/assets/53836821/9be16515-c740-4905-bea1-88871112ef86
TODOs
- [x] Provide `enable_preview_tabs` setting
- [x] Write some tests
- [x] How should we handle this in collaboration mode (have not tested
the behavior so far)
- [x] Keyboard driven usage (probably need workspace commands)
- [x] Register `TogglePreviewTab` only when setting enabled?
- [x] Render preview tabs in tab switcher as italic
- [x] Render preview tabs in image viewer as italic
- [x] Should this be enabled by default (it is the default behavior in
VSCode)?
- [x] Docs
Future improvements (out of scope for now):
- Support preview mode for find all references and possibly other
multibuffers (VSCode: "Enable Preview From Code Navigation")
Release Notes:
- Added preview tabs
([#4922](https://github.com/zed-industries/zed/issues/4922)).
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Absent some ability to toggle between viewing and editing a file, I
think it would be best to get a fix out quick for people to edit SVGs as
text files.
Release Notes:
- Fixed editing of SVG images by disabling it from the image viewer
([#10403](https://github.com/zed-industries/zed/issues/10403)).
Fixes regression from https://github.com/zed-industries/zed/pull/10341
where it was not possible to use non-zed environmental variables (e.g.
$PATH) in task definitions.
No release note, as this didn't land on Preview yet.
Release Notes:
- N/A
Release Notes:
- Extracted lua language support into an extension, and improved Lua
highlighting and completion label styling.
---------
Co-authored-by: Marshall <marshall@zed.dev>
Release Notes:
- Extracted GLSL language support into an extension.
---------
Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Release Notes:
- Fixed a bug where extension installation would appear to succeed even
if the download did not complete due to network interruptions
([#10330](https://github.com/zed-industries/zed/issues/10330)).
Co-authored-by: Marshall <marshall@zed.dev>
As of #10393 some icons in the chat were invisible, looking at the icons
I noticed that the viewport was actually 800x800, I scaled that down to
16x16 and now they work fine again.
Also remove the `reply_arrow_left` icon because it is not used at all.
Thanks to @RemcoSmitsDev for noticing.
I don't have any expertise in svg's, so if something is off about the
svg markup reach out to me.
Release Notes:
- N/A
Fixes#7694
The new setting accepts "last_workspace" (default) and "none" as
options.
In a follow-up PR I'll add a new option that re-launches all of the Zed
windows and not just the last one.
Release Notes:
- Added `restore_on_startup` option, accepting `last_workspace`
(default) and `none` options. With `none`, new Zed instances will not
restore workspaces that were open last.
Release Notes:
- Added support for toggling a checkbox in markdown preview by clicking
on it (cmd+click)
([#5226](https://github.com/zed-industries/zed/issues/5226)).
---------
Co-authored-by: Remco Smits <62463826+RemcoSmitsDev@users.noreply.github.com>
Release Notes:
- Added support for scrolling to the message you are replying to when
clicking on the reply preview
([#10028](https://github.com/zed-industries/zed/issues/10028)).
Co-authored-by: Bennet Bo Fenner <53836821+bennetbo@users.noreply.github.com>
New list (used tasks are above the separator line, sorted by the usage
recency), then all language tasks, then project-local and global tasks
are listed.
Note that there are two test tasks (for `test_name_1` and `test_name_2`
functions) that are created from the same task template:
<img width="563" alt="Screenshot 2024-04-10 at 01 00 46"
src="https://github.com/zed-industries/zed/assets/2690773/7455a82f-2af2-47bf-99bd-d9c5a36e64ab">
Tasks are deduplicated by labels, with the used tasks left in case of
the conflict with the new tasks from the template:
<img width="555" alt="Screenshot 2024-04-10 at 01 01 06"
src="https://github.com/zed-industries/zed/assets/2690773/8f5a249e-abec-46ef-a991-08c6d0348648">
Regular recent tasks can be now removed too:
<img width="565" alt="Screenshot 2024-04-10 at 01 00 55"
src="https://github.com/zed-industries/zed/assets/2690773/0976b8fe-b5d7-4d2a-953d-1d8b1f216192">
When the caret is in the place where no function symbol could be
retrieved, no cargo tests for function are listed in tasks:
<img width="556" alt="image"
src="https://github.com/zed-industries/zed/assets/2690773/df30feba-fe27-4645-8be9-02afc70f02da">
Part of https://github.com/zed-industries/zed/issues/10132
Reworks the task code to simplify it and enable proper task labels.
* removes `trait Task`, renames `Definition` into `TaskTemplate` and use
that instead of `Arc<dyn Task>` everywhere
* implement more generic `TaskId` generation that depends on the
`TaskContext` and `TaskTemplate`
* remove `TaskId` out of the template and only create it after
"resolving" the template into the `ResolvedTask`: this way, task
templates, task state (`TaskContext`) and task "result" (resolved state)
are clearly separated and are not mixed
* implement the logic for filtering out non-related language tasks and
tasks that have non-resolved Zed task variables
* rework Zed template-vs-resolved-task display in modal: now all reruns
and recently used tasks are resolved tasks with "fixed" context (unless
configured otherwise in the task json) that are always shown, and Zed
can add on top tasks with different context that are derived from the
same template as the used, resolved tasks
* sort the tasks list better, showing more specific and least recently
used tasks higher
* shows a separator between used and unused tasks, allow removing the
used tasks same as the oneshot ones
* remote the Oneshot task source as redundant: all oneshot tasks are now
stored in the inventory's history
* when reusing the tasks as query in the modal, paste the expanded task
label now, show trimmed resolved label in the modal
* adjusts Rust and Elixir task labels to be more descriptive and closer
to bash scripts
Release Notes:
- Improved task modal ordering, run and deletion capabilities
This PR reworks the way workspace notifications are identified to use a
new `NotificationId` type.
A `NotificationId` is bound to a given type that is used as a unique
identifier. Generally this will be a unit struct that can be used to
uniquely identify this notification.
A `NotificationId` can also accept an optional `ElementId` in order to
distinguish between different notifications of the same type.
This system avoids the issue we had previously of selecting `usize` IDs
somewhat arbitrarily and running the risk of having two independent
notifications collide (and thus interfere with each other).
This also fixes a bug where multiple suggestion notifications for the
same extension could be live at once
Fixes https://github.com/zed-industries/zed/issues/10320.
Release Notes:
- Fixed a bug where multiple extension suggestions for the same
extension could be shown at once
([#10320](https://github.com/zed-industries/zed/issues/10320)).
---------
Co-authored-by: Max <max@zed.dev>
Currently in Zed, certain characters require pressing the key twice to
move the caret through that character. For example: "❤️" and "y̆".
The reason for this is as follows:
Currently, Zed uses `chars` to distinguish different characters, and
calling `chars` on `y̆` will yield two `char` values: `y` and `\u{306}`,
and calling `chars` on `❤️` will yield two `char` values: `❤` and
`\u{fe0f}`.
Therefore, consider the following scenario (where ^ represents the
caret):
- what we see: ❤️ ^
- the actual buffer: ❤ \u{fe0f} ^
After pressing the left arrow key once:
- what we see: ❤️ ^
- the actual buffer: ❤ ^ \u{fe0f}
After pressing the left arrow key again:
- what we see: ^ ❤️
- the actual buffer: ^ ❤ \u{fe0f}
Thus, two left arrow key presses are needed to move the caret, and this
PR fixes this bug (or this is actually a feature?).
I have tried to keep the scope of code modifications as minimal as
possible. In this PR, Zed handles such characters as follows:
- what we see: ❤️ ^
- the actual buffer: ❤ \u{fe0f} ^
After pressing the left arrow key once:
- what we see: ^ ❤️
- the actual buffer: ^ ❤ \u{fe0f}
Or after pressing the delete key:
- what we see: ^
- the actual buffer: ^
Please note that currently, different platforms and software handle
these special characters differently, and even the same software may
handle these characters differently in different situations. For
example, in my testing on Chrome on macOS, GitHub treats `y̆` as a
single character, just like in this PR; however, in Rust Playground,
`y̆` is treated as two characters, and pressing the delete key does not
delete the entire `y̆` character, but instead deletes `\u{306}` to yield
the character `y`. And they both treat `❤️` as a single character,
pressing the delete key will delete the entire `❤️` character.
This PR is based on the principle of making changes with the smallest
impact on the code, and I think that deleting the entire character with
the delete key is more intuitive.
Release Notes:
- Fix caret movement issue for some special characters
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Co-authored-by: Thorsten <thorsten@zed.dev>
Co-authored-by: Bennet <bennetbo@gmx.de>
This PR fixes a potential panic that could occur when loading malformed
Wasm files.
We now use the `parse_wasm_extension_version` function that was
previously used just to extract the Zed extension API version from the
Wasm bytes as a pre-validation step. By parsing the entirety of the Wasm
file here instead of returning as soon as we find the version, the
invalid Wasm bytes are now surfaced as an `Err` instead of a panic.
We were able to replicate the panic using the following test:
```rs
#[gpui::test]
async fn test_bad_wasm(cx: &mut TestAppContext) {
init_test(cx);
let wasm_host = cx.update(|cx| {
WasmHost::new(
FakeFs::new(cx.background_executor().clone()),
FakeHttpClient::with_200_response(),
FakeNodeRuntime::new(),
Arc::new(LanguageRegistry::test(cx.background_executor().clone())),
PathBuf::from("/the/work/dir".to_string()),
cx,
)
});
let mut wasm_bytes = std::fs::read("/Users/maxdeviant/Library/Application Support/Zed/extensions/installed/dart/extension.wasm").unwrap();
// This is the error message we were seeing in the stack trace:
// range end index 267037 out of range for slice of length 253952
dbg!(&wasm_bytes.len());
// Truncate the bytes to the same point:
wasm_bytes.truncate(253952);
std::fs::write("/tmp/bad-extension.wasm", wasm_bytes.clone()).unwrap();
let manifest = Arc::new(ExtensionManifest {
id: "the-extension".into(),
name: "The Extension".into(),
version: "0.0.1".into(),
schema_version: SchemaVersion(1),
description: Default::default(),
repository: Default::default(),
authors: Default::default(),
lib: LibManifestEntry {
kind: None,
version: None,
},
themes: Default::default(),
languages: Default::default(),
grammars: Default::default(),
language_servers: Default::default(),
});
// 💥
let result = wasm_host
.load_extension(wasm_bytes, manifest, cx.executor())
.await;
dbg!(result.map(|_| ()));
```
Release Notes:
- Fixed a crash that could occur when loading malformed Wasm extensions
([#10352](https://github.com/zed-industries/zed/issues/10352)).
---------
Co-authored-by: Max <max@zed.dev>
There hasn't been a componentized way to create inputs or text fields
thus far due to the innate circular dependency between the `ui` and
`editor` crates. To bypass this issue we are introducing a new
`ui_text_field` crate to specifically handle this component.
`TextField` provides the ability to add stacked or inline labels, as
well as applies a standard visual style to inputs.
Example:
![CleanShot - 2024-04-10 at 11 22
13@2x](https://github.com/zed-industries/zed/assets/1714999/9bf5fc40-5024-4d01-9a8b-fb76f67d7e6e)
We'll continue to evolve this component in the near future and start
using it in the app once we've built out the needed functionality.
Release Notes:
- N/A
---------
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This panic has occured a handful of times, I think it must be the case
that:
1. Item is dropped outside of an update loop
2. The next update is this one
In that case no flush effects will have called the release observers
yet, but we cannot upgrade the WeakModel because the ref count is 0
Release Notes:
- Fixed a (rare) panic while collaborating
This PR renames `language::Buffer::new` to `language::Buffer::local` and
simplifies its interface. Instead of taking a replica id (which should
always be 0 for the local case) and a `BufferId`, which was awkward and
verbose to construct, it simply takes text and a `cx`.
It uses the `cx` to derive a `BufferId` from the `EntityId` associated
with the `cx`, which should always be positive based on the following
analysis...
We convert the entity id to a u64 using this method on `EntityId`, which
is defined by macros in the `slotmap` crate:
```rust
pub fn as_ffi(self) -> u64 {
(u64::from(self.version.get()) << 32) | u64::from(self.idx)
}
```
If you look at the type of `version` in `KeyData`, it is non-zero:
```rust
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct KeyData {
idx: u32,
version: NonZeroU32,
}
```
This commit also adds `Context::reserve_model` and
`Context::insert_model` to determine a model's entity ID before it is
created, which we need in order to assign a `BufferId` in the background
when loading a buffer asynchronously.
Release Notes:
- N/A
---------
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
- Fixed#8603
For the label title of the project panel, I find that there is no place
to use to get the title of the label to do some operations, it should be
safe to modify it, but I'm not sure how we need to modify the problem, I
can think of two scenarios:
1. Modify every place where you don't want multiple lines to appear
2. Make the label only display a single line (e.g. provide a new
parameter, or a new label type?)
Followup to #10327
It can be enabled with the following setting:
"line_indicator_format": "short"
No release note, as the original change didn't go out to Preview yet.
/cc @bartekpacia @0x2CA
Release Notes:
- N/A
This fixes certain shortcuts/motions on X11 like in vim mode "v i )",
where previously zed would interpret it as "v i SHIFT )" due to the x11
backend emitting key press events for modifier keys even though other
platforms like Wayland don't. This also adds support for
ModifiersChanged events to X11
Release Notes:
- Fixed vim motions like "v i )" not working on X11
([#10199](https://github.com/zed-industries/zed/issues/10199)).
Release Notes:
- N/A
Picks up https://github.com/kvark/blade/pull/105,
https://github.com/kvark/blade/pull/97, and more
Switches the presentation to be non-blocking, which will improve the
latency slightly.
Allows to start playing with GLES backend, e.g.
```bash
cd crates/gpui
RUSTFLAGS="--cfg gles" CARGO_TARGET_DIR=./target-gl cargo run --example hello_world
```
It doesn't currently render properly due to an issue that needs
investigation, see
https://github.com/kvark/blade/pull/105#issuecomment-2041006542
But at least it's a start
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
This fixes a bug in https://github.com/zed-industries/zed/pull/9818,
where the status was not removed if the request failed. It also adds
replication of these new status messages to guests when collaborating.
Release Notes:
- Fixed an issue where the status of failed LSP actions was left in the
status bar
---------
Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This fixed an issue introduced in
https://github.com/zed-industries/zed/pull/10126, where, when toggling
comments in a language with multiple line comment prefixes (e.g. Gleam,
Erlang) Zed would insert the *last* prefix instead of the first.
Release Notes:
- Fixed an issue where the `toggle comments` command inserted the wrong
line comment prefix in some languages (preview only).
Co-authored-by: Marshall <marshall@zed.dev>
Part of https://github.com/zed-industries/zed/issues/10132 extracted out
of a bigger PR that refactors tasks and shows labels that look more like
commands (ergo needs better readable package names)
Release Notes:
- N/A
This should help with some of the memory problems reported in
https://github.com/zed-industries/zed/issues/8436, especially the ones
related to large files (see:
https://github.com/zed-industries/zed/issues/8436#issuecomment2037442695),
by **reducing the memory required to represent a buffer in Zed by
~50%.**
### How?
Zed's memory consumption is dominated by the in-memory representation of
buffer contents.
On the lowest level, the buffer is represented as a
[Rope](https://en.wikipedia.org/wiki/Rope_(data_structure)) and that's
where the most memory is used. The layers above — buffer, syntax map,
fold map, display map, ... — basically use "no memory" compared to the
Rope.
Zed's `Rope` data structure is itself implemented as [a `SumTree` of
`Chunks`](8205c52d2b/crates/rope/src/rope.rs (L35-L38)).
An important constant at play here is `CHUNK_BASE`:
`CHUNK_BASE` is the maximum length of a single text `Chunk` in the
`SumTree` underlying the `Rope`. In other words: It determines into how
many pieces a given buffer is split up.
By changing `CHUNK_BASE` we can adjust the level of granularity
withwhich we index a given piece of text. Theoretical maximum is the
length of the text, theoretical minimum is 1. Sweet spot is somewhere
inbetween, where memory use and performance of write & read access are
optimal.
We started with `16` as the `CHUNK_BASE`, but that wasn't the result of
extensive benchmarks, more the first reasonable number that came to
mind.
### What
This changes `CHUNK_BASE` from `16` to `64`. That reduces the memory
usage, trading it in for slight reduction in performance in certain
benchmarks.
### Benchmarks
I added a benchmark suite for `Rope` to determine whether we'd regress
in performance as `CHUNK_BASE` goes up. I went from `16` to `32` and
then to `64`. While `32` increased performance and reduced memory usage,
`64` had one slight drop in performance, increases in other benchmarks
and substantial memory savings.
| `CHUNK_BASE` from `16` to `32` | `CHUNK_BASE` from `16` to `64` |
|-------------------|--------------------|
|
![chunk_base_16_to_32](https://github.com/zed-industries/zed/assets/1185253/fcf1f9c6-4f43-4e44-8ef5-29c1e5d8e2b9)
|
![chunk_base_16_to_64](https://github.com/zed-industries/zed/assets/1185253/d82a0478-eeef-43d0-9240-e0aa9df8d946)
|
### Real World Results
We tested this by loading a 138 MB `*.tex` file (parsed as plain text)
into Zed and measuring in `Instruments.app` the allocation.
#### standard allocator
Before, with `CHUNK_BASE: 16`, the memory usage was ~827MB after loading
the buffer.
| `CHUNK_BASE: 16` |
|---------------------|
|
![memory_consumption_chunk_base_16_std_alloc](https://github.com/zed-industries/zed/assets/1185253/c1e04c34-7d1a-49fa-bb3c-6ad10aec6e26)
|
After, with `CHUNK_BASE: 64`, the memory usage was ~396MB after loading
the buffer.
| `CHUNK_BASE: 64` |
|---------------------|
|
![memory_consumption_chunk_base_64_std_alloc](https://github.com/zed-industries/zed/assets/1185253/c728e134-1846-467f-b20f-114a582c7b5a)
|
#### `mimalloc`
`MiMalloc` by default and that seems to be pretty aggressive when it
comes to growing memory. Whereas the std allocator would go up to
~800mb, MiMalloc would jump straight to 1024MB.
I also can't get `MiMalloc` to work properly with `Instruments.app` (it
always shows 15MB of memory usage) so I had to use these `Activity
Monitor` screenshots:
| `CHUNK_BASE: 16` |
|---------------------|
|
![memory_consumption_chunk_base_16_mimalloc](https://github.com/zed-industries/zed/assets/1185253/1e6e05e9-80c2-4ec7-9b0e-8a6fa78836eb)
|
| `CHUNK_BASE: 64` |
|---------------------|
|
![memory_consumption_chunk_base_64_mimalloc](https://github.com/zed-industries/zed/assets/1185253/8a47e982-a675-4db0-b690-d60f1ff9acc8)
|
### Release Notes
Release Notes:
- Reduced memory usage for files by up to 50%.
---------
Co-authored-by: Antonio <antonio@zed.dev>
To reference the system font, use the special ".SystemUIFont" family
name.
/cc @PixelJanitor
Release Notes:
- Switched to the system UI font for user interface elements on macOS.
Co-authored-by: Antonio Scandurra <antonio@zed.dev>
This PR makes it so our temporary host-side workaround for setting
certain language server binaries as executable only applies to binaries
that are downloaded by the extension.
Previously we would do this for any binary, including ones that could
have been sourced from the $PATH.
Release Notes:
- Fixed a file permissions issue when trying to use a Zig language
server (`zls`) present on the $PATH.
Fixed#10149
A user had Zed crash due to invalid font size in settings. It turned out
the width/height of glyphs does not pass validation in Metal texture
initialization with a large enough font size.
All modern Macs have a max texture width/height of 16kB (barring Apple
A8, used by iPhone 6 back in 2014, which uses 8kB). This commit clamps
texture size at 16kB. Note that while it fixes Zed crash, using a font
size that hits the limit is still pretty unusable - the users will still
have a pretty unusable editor, but at least it won't crash for them.
Release Notes:
- Fixed crashes with huge `buffer_font_size` values.
This PR changes ways the Find/Replace functionality in the
Buffer/Project Search is accessible via shortcuts. It makes those panels
work the same way as in VS Code and Sublime Text.
The details are described in the issue: [Make Find/Replace easier to
use](https://github.com/zed-industries/zed/issues/9142)
There's a difficulty with the Linux keybindings:
VS Code uses on MacOS (this PR replicates it):
| Action | Buffer Search | Project Search |
| --- | --- | --- |
| Find | `cmd-f` | `cmd-shift-f` |
| Replace | `cmd-alt-f` | `cmd-shift-h` |
VS Code uses on Linux (this PR replicates all but one):
| Action | Buffer Search | Project Search |
| --- | --- | --- |
| Find | `ctrl-f` | `ctrl-shift-f` |
| Replace | `ctrl-h` ❗ | `ctrl-shift-h` |
The problem is that `ctrl-h` is already taken by the `editor::Backspace`
action in Zed on Linux.
There's two options here:
1. Change keybinding for `editor::Backspace` on Linux to something else,
and use `ctrl-h` for the "replace in buffer" action.
2. Use some other keybinding on Linux in Zed. This PR introduces
`ctrl-r` for this purpose, though I'm not sure it's the best choice.
What do you think?
fixes#9142
Release Notes:
- Improved access to "Find/Replace in Buffer" and "Find/Replace in
Files" via shortcuts (#9142).
Optionally, include screenshots / media showcasing your addition that
can be included in the release notes.
- N/A
This PR flips the optionality of the `AutoUpdateSettingContent` to make
it a bit easier to work with.
#### Before
```rs
struct AutoUpdateSettingContent(Option<bool>);
type FileContent = AutoUpdateSettingContent;
```
#### After
```rs
struct AutoUpdateSettingContent(bool);
type FileContent = Option<AutoUpdateSettingContent>;
```
Release Notes:
- N/A
This puts the Linux platform implementation at a similar code style and
quality to the macOS platform. The largest change is that I collapsed
the `LinuxPlatform` -> `[Backend]` -> `[Backend]State` ->
`[Backend]StateInner` to just `[Backend]` and `[Backend]State`, and in
the process removed most of the `Rc`s and `RefCell`s.
TODO:
- [x] Make sure that this is on-par with the existing implementation
- [x] Review in detail, now that the large changes are done.
- [ ] Update the roadmap
Release Notes:
- N/A
This PR fixes a panic when attempting to load the `auto_update` setting.
This was leftover from #10296.
I'm going to see if there's a better way we can handle these cases so
they're more obviously correct.
Release Notes:
- N/A
This PR adds the ability for extensions to provide certain language
settings via the language `config.toml`.
These settings are then merged in with the rest of the settings when the
language is loaded from the extension.
The language settings that are available are:
- `tab_size`
- `hard_tabs`
- `soft_wrap`
Additionally, for bundled languages we moved these settings out of the
`settings/default.json` and into their respective `config.toml`s .
For languages currently provided by extensions, we are leaving the
values in the `settings/default.json` temporarily until all released
versions of Zed are able to load these settings from the extension.
---
Along the way we ended up refactoring the `Settings::load` method
slightly, introducing a new `SettingsSources` struct to better convey
where the settings are being loaded from.
This makes it easier to load settings from specific locations/sets of
locations in an explicit way.
Release Notes:
- N/A
---------
Co-authored-by: Max <max@zed.dev>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Release Notes:
- Fixed `cgn` backwards movement problem in #9982
There are two issues:
- When there are no more matches, the next repetition still moves the
cursor to the left. After that, the recording is cleared. For this I
simply move the cursor to the right, but it doesn't work when the cursor
is at the end of the line.
- If `cgn` is used when there are no matches, it cleans the previous
recorded actions. Maybe there should be a way to revert the recording.
This also happens when using `c` and `esc`
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This PR contains various improvements for the markdown preview (some of
which were originally part of #7601).
Some improvements can be seen in the video (see also release notes down
below):
https://github.com/zed-industries/zed/assets/53836821/93324ee8-d366-464a-9728-981eddbfdaf7
Release Notes:
- Added action to open markdown preview in the same pane
- Added support for displaying channel notes in markdown preview
- Added support for displaying the current active editor when opening
markdown preview
- Added support for scrolling the editor to the corresponding block when
double clicking an element in markdown preview
- Improved pane creation handling when opening markdown preview
- Fixed markdown preview displaying non-markdown files
This PR updates the `extension.toml` to allow specifying multiple
languages for a language server to work with.
The `languages` field takes precedence over `language`. In the future
the `language` field will be removed.
As part of this, the Emmet extension has been extended with support for
PHP and ERB.
Release Notes:
- N/A
---------
Co-authored-by: Max <max@zed.dev>
- Fixed#9729 and #10193
This commit fixes an issue where the string splitting function was
handling characters in the input string improperly. We adjusted the use
of the `take_while` function to calculate the length of the numeric
prefix, rather than directly splitting the string, thus correctly
splitting the string into a numeric prefix part and the remaining part
This increases search context from 1 above, 2 below, to 2 above and 2
below, matching the Sublime Text search results.
Release Notes:
- Increased search result context from 3 lines to 4 lines
For #4965
There are still some minor issues:
1. When change the surround and delete the surround, we should also
decide whether there are spaces inside after deleting/replacing
according to whether it is open parentheses, and replace them
accordingly, but at present, delete and change, haven't done this
adaptation for current pr, I'm not sure if I can fit it in the back or
if it needs to be fitted together.
2. In the selection mode, pressing s plus brackets should also trigger
the Add Surrounds function, but this MR has not adapted the selection
mode for the time being, I think we need to support different add
behaviors for the three selection modes.(Currently in select mode, s is
used for Substitute)
3. For the current change surrounds, if the user does not find the
bracket that needs to be matched after entering cs, but it is a valid
bracket, and will wait for the second input before failing, the better
practice here should be to return to normal mode if the first bracket is
not found
4. I reused BracketPair in language, but two of its properties weren't
used in this mr, so I'm not sure if I should create a new struct with
only start and end, which would have less code
I'm not sure which ones need to be changed in the first issue, and which
ones can be revised in the future, and it seems that they can be solved
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Fixes: #10266
Release Notes:
- Added/Fixed/Improved ...
([#<public_issue_number_if_exists>](https://github.com/zed-industries/zed/issues/<public_issue_number_if_exists>)).
Optionally, include screenshots / media showcasing your addition that
can be included in the release notes.
**or**
- N/A
This PR makes Zed respect the language server's capabilities when
calling the `GetReferences` command (used in "Find All References",
etc.).
This fixes a crash that could occur when using Zed with Gleam v1.0.
Release Notes:
- Made "Find All References" respect the language server's capabilities.
This fixes some instances where certain language servers would stop
working after receiving a "Find All References" request.
---------
Co-authored-by: Max <max@zed.dev>
At the moment, the editor scrollbar is 12px wide. One pixel is allocated
for the left border, so we have 11 pixels to display markers. It's not
enough to make three even marker columns (git, highlights, diagnostics)
that fully fill the scrollbar, so the current implementation allocates 3
pixels to each column.
As the result, we have 2 spare pixels on the right (before #10080 they
were occupied by the diagnostics column). Making the scrollbar just one
pixel wider allows us to give one additional pixel to each marker column
and make markers more pronounced ("as is" on the left, "to be" on the
right):
<img width="115" alt="zed-scrollbar-markers-1px"
src="https://github.com/zed-industries/zed/assets/2101250/4bdf0107-c0f1-4c9c-9063-d2ff461e1c32">
Other options:
- Remove scrollbar thumb border. That'll give us one missing pixel to
make markers wide and even. I, personally, prefer this option, but
themes now have `scrollbar.thumb.border` colors that differ from
`scrollbar.thumb.background` for some reason. This theme setting becomes
deprecated in this case. For the reference: VS Code doesn't have
scrollbar slider borders, IntelliJ IDEA does have them.
- Don't try to make markers evenly wide. For instance, IntelliJ uses
very narrow git-diff markers that are separated from other markers. But
it requires much wider scrollbar (it's 20px in IDEA).
- Use the spare two pixels to make diagnostic markers wider (it's the
pre #10080 approach), or split them between the highlight and diagnostic
markers (have 3px+4px+4px marker columns).
- Do nothing. It leaves us with two unused pixels :(
Release Notes:
- N/A
Related Issues:
- The previous discussion:
https://github.com/zed-industries/zed/pull/9080#issuecomment-1997979968