Commit Graph

19279 Commits

Author SHA1 Message Date
Kyle Kelley
5037f466f6
Defer first update active buffer for conversation (#10564)
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>
2024-04-15 11:11:02 -06:00
Marshall Bowers
f28fde5e58
Move constraints to query parameters for GET /extensions/:extension_id/download (#10562)
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
2024-04-15 13:06:20 -04:00
Thorsten Ball
d1928f084e
Remove TODO by defining constant (#10556)
Release Notes:

- N/A
2024-04-15 18:37:03 +02:00
Piotr Osiewicz
ad22bddffa
diagnostics: Update diagnostics more eagerly (#10560)
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.
2024-04-15 18:28:58 +02:00
Thorsten Ball
da0d968a2c
zig: Use env if using zls from shell env (#10559)
This fixes the problem of the Zig extension picking up `zls` from the
shell env but `zls` then failing to launch because it cannot find `zig`.

Scenario in which this happens:
- `.envrc` in a project that sets `$PATH` up
- in that `$PATH` there's `zls` and `zig`
- Zed is started from Dock
- Project is opened
- Shell env from project directory is loaded and used to get to `zls`
- `zls` is then started, without that environment set on the process
- `zls` cannot find `zig`

Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-04-15 17:39:07 +02:00
Antonio Scandurra
200e36311c
Intersect content mask with hitbox bounds only during hit test (#10554)
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
2024-04-15 15:09:15 +02:00
Kirill Bulatov
db48c75231
Add basic bash and Python tasks (#10548)
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
2024-04-15 16:07:21 +03:00
Carter Olsen
1911a9f39b
Add a setting to control the vertical and horizontal scroll sensitivity (#10244)
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.
2024-04-15 14:40:09 +02:00
Thorsten Ball
faebce8cd0
Inline git blame (#10398)
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`.
2024-04-15 14:21:52 +02:00
Kirill Bulatov
573ba83034
Merge Zed task context providing logic (#10544)
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
2024-04-15 11:52:15 +03:00
Marshall Bowers
97c5cffbe3
Update contributing docs to point to extensions (#10537)
This PR updates the contributing docs to remove an outdated section
about extension support and instead point to the extension authoring
docs.

Release Notes:

- N/A
2024-04-14 19:31:19 -04:00
apricotbucket28
556ecd94c2
blade: Fix incorrect texture format (#10524)
Fixes image rendering
Closes https://github.com/zed-industries/zed/issues/10505

Before:

![image](https://github.com/zed-industries/zed/assets/71973804/3a903279-d631-4ca6-9f46-3065c7ed3073)


After:

![image](https://github.com/zed-industries/zed/assets/71973804/ab3a73e5-bf21-4df7-a9c1-a74bd1993a5b)


Release Notes:

- N/A
2024-04-14 11:46:31 -07:00
Mikayla Maki
3289188e0a
linux: Simplify scrolling implementation (#10497)
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
2024-04-12 15:54:11 -07:00
Max Brunsfeld
5e4f707951 Change authors of lua extension 2024-04-12 15:15:40 -07:00
Conrad Irwin
5d7642d77d
Update netrw bindings for preview panes (#10492)
Release Notes:

- N/A
2024-04-12 14:50:27 -06:00
Conrad Irwin
e64ecdc9ab
Add missing block.copy() (#10496)
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
2024-04-12 14:50:12 -06:00
Conrad Irwin
ba9c5929af
Fix emojis when rendering with the system ui font (#10491)
Release Notes:

- N/A
2024-04-12 14:05:01 -06:00
Marshall Bowers
ad8dd1771a
lua: Fix extension version (#10490)
This PR fixes the Lua extension version to be v0.0.1 instead of v0.1.0
for the initial release.

Release Notes:

- N/A
2024-04-12 15:38:26 -04:00
usr
cb6d0639db
Windows: Fix crash when trying to copy nothing to clipboard (#10405)
Release Notes:

- N/A
2024-04-12 12:33:20 -07:00
Mikayla Maki
065f15e9a6
Use buffer font when rendering editor breadcrumbs and diagnostics (#10488)
Before:

<img width="592" alt="Screenshot 2024-04-12 at 12 00 00 PM"
src="https://github.com/zed-industries/zed/assets/2280405/3251743e-4f2c-4ca3-9bc5-88f37660f7b9">

After:

<img width="673" alt="Screenshot 2024-04-12 at 12 11 37 PM"
src="https://github.com/zed-industries/zed/assets/2280405/6a8ac597-261a-45d9-bf2a-a673b6f26b0e">


Release Notes:

- N/A
2024-04-12 12:29:00 -07:00
张小白
104558115f
windows: Update WindowsDisplay::frequency() (#10476)
A subsequent update introduced the `HMONITOR` value to the
`WindowsDisplay` struct, eliminating the need for polling to retrieve
this value.

Release Notes:

- N/A
2024-04-12 12:19:49 -07:00
CharlesChen0823
4e6f24a841
Only emit resize event when size changed (#10419)
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
2024-04-12 12:18:56 -07:00
Marshall Bowers
f3a78f613a
Extract Vue extension (#10486)
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>
2024-04-12 14:39:27 -04:00
Yury Abykhodau
8bca9cea26
Fix Auto folded dirs performance issues (#8556)
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>
2024-04-12 11:26:26 -07:00
Kirill Bulatov
28586060a1
Display more specific tasks above in the modal (#10485) 2024-04-12 20:19:11 +02:00
Kyle Kelley
49371b44cb
Semantic Index (#10329)
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>
2024-04-12 11:40:59 -06:00
Maxime Forveille
4b40e83b8b
gpui: Fix window title special characters display on X11 (#9994)
Before:

![image](https://github.com/zed-industries/zed/assets/13511978/f12a144a-5c41-44e9-8422-aa73ea54fb9c)

After:

![image](https://github.com/zed-industries/zed/assets/13511978/45e9b701-77a8-4e63-9481-dab895a347f7)

Release Notes:

- Fixed window title special characters display on X11.

---------

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-04-12 09:49:31 -07:00
Conrad Irwin
dffddaec4c
Revert "Revert "language: Remove buffer fingerprinting (#9007)"" (#9671)
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>
2024-04-12 18:40:35 +02:00
Marshall Bowers
a4d6c5da7c
toml: Bump to v0.1.0 (#10482)
This PR bumps the TOML extension to v0.1.0.

This version of the extension has been updated to use v0.0.6 of the
`zed_extension_api`.

Release Notes:

- N/A
2024-04-12 12:39:43 -04:00
Hans
3ea17248c8
Adjust left movement when soft_wrap mode is used (#10464)
Release Notes:

- Added/Fixed #10350
2024-04-12 10:36:31 -06:00
Marshall Bowers
e0e1103228
zig: Bump to v0.1.0 (#10481)
This PR bumps the Zig extension to v0.1.0.

This version of the extension has been updated to use v0.0.6 of the
`zed_extension_api`.

It also adds support for treating `.zig.zon` files as Zig files
(#10012).

Release Notes:

- N/A
2024-04-12 12:30:29 -04:00
Marshall Bowers
65c9e7d3d1
php: Bump to v0.0.2 (#10480)
This PR bumps the PHP extension to v0.0.2.

This version of the PHP extension adds the `language_ids` mappings from
#10053.

Release Notes:

- N/A
2024-04-12 12:19:01 -04:00
Marshall Bowers
b5b872656b
Extract Terraform extension (#10479)
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.
2024-04-12 11:49:49 -04:00
Bennet Bo Fenner
f4d9a97195
preview tabs: Support find all references (#10470)
`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
2024-04-12 17:22:12 +02:00
Bennet Bo Fenner
7b01a29f5a
preview tabs: Fix tab selection getting out of sync (#10478)
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
2024-04-12 17:20:30 +02:00
张小白
04e89c4c51
Use workspace uuid (#10475)
Release Notes:

- N/A
2024-04-12 10:53:10 -04:00
Conrad Irwin
0ab5a524b0
Fix overlap (#10474)
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
2024-04-12 08:25:09 -06:00
Bennet Bo Fenner
cd5ddfe34b
chat panel: Add timestamp in tooltip to edited message (#10444)
Hovering over the `(edited)` text inside a message displays a tooltip
with the timestamp of when the message was last edited:


![image](https://github.com/zed-industries/zed/assets/53836821/be6d68c2-7447-42bc-bd5e-7a9053b3c980)

---

Also removed the `fade_out` style for the `(edited)` text, as this was
causing tooltips to fade out as well:


![image](https://github.com/zed-industries/zed/assets/53836821/91d3cf6a-db58-4e1d-b257-663b2ce1aca4)

Instead it uses `theme().text_muted` now.


Release Notes:

- Hovering over an edited message now displays a tooltip revealing the
timestamp of the last edit.
2024-04-12 14:26:41 +02:00
Bennet Bo Fenner
0a4c3488dd
Fix typo in README (#10471)
Fixes a typo in the README which I believe was accidentally committed
yesterday in #10459


Release Notes:

- N/A
2024-04-12 14:18:54 +02:00
Piotr Osiewicz
a1cbc23fee
task: use full task label to distinguish a terminal (#10469)
Spotted by @SomeoneToIgnore, in #10468 I've used a shortened task label,
which might lead to collisions.

Release Notes:

- N/A
2024-04-12 13:25:46 +02:00
Piotr Osiewicz
298e9c9387
task: Allow Rerun action to override properties of task being reran (#10468)
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.
2024-04-12 12:44:50 +02:00
Thorsten Ball
6e1ba7e936
Allow hovering over tooltips in git blame sidebar (#10466)
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>
2024-04-12 11:47:32 +02:00
Thorsten Ball
bc0c2e0cae
Extend Vim default keybindings (#10461)
This implements some of #10457.

Release notes:

- Added `g c c` and `g c` to Vim keybindings to toggle comments in
normal and visual mode respectively.
- Added `g ]` and `g [` to Vim keybindings to go to next and previous
diagnostic error.
- Changed `[ x` and `] x` (which select larger/smaller syntax node) in
Vim mode to also work in visual mode.
2024-04-12 08:05:38 +02:00
Mehmet Efe Akça
29a50573a9
Add git blame error reporting with notification (#10408)
<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>
2024-04-12 07:20:34 +02:00
Conrad Irwin
08786fa7bf
Make BufferSearch less wide (#10459)
This also adds some "responsiveness" so that UI elements are hidden
before everything has to be occluded

Release Notes:

- Improved search UI. It now works in narrower panes, and avoids
scrolling the editor on open.

<img width="899" alt="Screenshot 2024-04-11 at 21 33 17"
src="https://github.com/zed-industries/zed/assets/94272/44b95d4f-08d6-4c40-a175-0e594402ca01">
<img width="508" alt="Screenshot 2024-04-11 at 21 33 45"
src="https://github.com/zed-industries/zed/assets/94272/baf4638d-427b-43e6-ad67-13d43f0f18a2">
<img width="361" alt="Screenshot 2024-04-11 at 21 34 00"
src="https://github.com/zed-industries/zed/assets/94272/ff60b561-2f77-49c0-9df7-e26227fe9225">
<img width="348" alt="Screenshot 2024-04-11 at 21 37 03"
src="https://github.com/zed-industries/zed/assets/94272/a2a700a2-ce99-41bd-bf47-9b14d7082b0e">
2024-04-11 23:07:29 -06:00
Hans
f2d61f3ea5
Add feature to display commands for vim mode (#10349)
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.
2024-04-12 06:39:57 +02:00
Conrad Irwin
98533079e4
Use buffer font for search (#10455)
It's wierd to type code/regex in the UI font

Release Notes:

- Continue to use buffer font for search
2024-04-11 22:15:12 -06:00
Nate Butler
27ba165046
Organize Project Panel context menus (#10456)
This design polish PR brings the project panel context menu into better
alignment with other editors, better follows system patterns and
identifies focus shifting actions with the `…` indicator (like adding a
new folder to a project, which will open a modal window.)

## Before & After:

**Root level**

![CleanShot - 2024-04-11 at 22 40
53@2x](https://github.com/zed-industries/zed/assets/1714999/aa103d14-0747-4be9-acbf-1c3ed0542a15)

**Folder level**

![CleanShot - 2024-04-11 at 22 43
45@2x](https://github.com/zed-industries/zed/assets/1714999/180224f2-26d1-45bd-8f78-822f46068a6d)

**File level**

![CleanShot - 2024-04-11 at 22 44
56@2x](https://github.com/zed-industries/zed/assets/1714999/67edd0ae-bcb6-4920-a480-c4d50c6bccfa)

Note: That double divider in the after has been fixed 😅

---

Release Notes:

- Improved ordering and organization of context menus in the project
panel to bring them closer to those in similar applications.
2024-04-11 22:52:49 -04:00
Hans
32806b8320
vim: Don’t allow edits in the read-only state (#10404)
Fix #8423 

Release Notes:

- vim: Fixed vim-surround motions editing read-only buffer
(preview-only)
2024-04-11 18:19:49 -06:00
CharlesChen0823
3ab9700155
Windows: Add missing delete key (#10422)
Add miss delete key in windows platform.
Release Notes:

- N/A
2024-04-11 16:20:28 -07:00