Commit graph

19486 commits

Author SHA1 Message Date
Ashish Bhate
1d26a27afa
go: Fix tree-sitter query for outlines (#24861)
Closes #14497

Release Notes:
- Fixed outline view for Go to correctly indent types and show missing
variables.
----
This PR fixes the tree-sitter query for outlines for Go code. It
correctly indents "grouped" `type` declarations. It also fixes missing
variables for "grouped" `var` declarations.

### Before: 
1. Incorrectly indented types from `G` to `K` and `aliasInt`
2. Missing vars `M` and `N` in outline 

![Screenshot_20250214_175404](https://github.com/user-attachments/assets/7c1142bd-fe60-4c65-9fa2-3bae4eb43d63)

### After:
1. Types no longer indented incorrectly
2. Missing vars `M` and `N` appear in the outline, as expected

![Screenshot_20250214_175431](https://github.com/user-attachments/assets/61010273-e98d-425d-93ad-17f04bd83b54)

### Caveats:
1. This fix comes from an hour or so of reading about tree-sitter and
its query syntax. I'm not an expert.
2. I'm not sure how to test this. I've done manual testing and it
appears to works as expected without an regressions.
2025-02-14 11:45:43 -08:00
Dino
294dea10e8
vim: Change into visual mode on select all matches (#24897)
This Pull Request fixes an issue where selecting all matches on a search
would not update vim to visual mode.

In the video below the following scenarios are tested:

1. Clicking "Select All Matches" in the buffer search bar correctly
changes vim to visual mode
2. Pressing Enter jumps the cursor to the first match and does not
change vim's mode
3. Selecting all matches with the `⌥⏎` changes vim to visual mode


https://github.com/user-attachments/assets/f7535638-987e-4f33-9364-292f99b60167

Thanks @ConradIrwin for both the quick pairing session and the solution!
🙇

Closes #14681 

Release Notes:

- vim: Use visual mode for "select all matches" in search (to be
consistent with `ga`)
2025-02-14 12:37:35 -07:00
Cole Miller
de020af6ef
Fix duplicate hunk controls after splitting DisplayDiffHunk (#24893)
This PR fixes expanded modification hunks having two sets of hunk
controls after #24834.

Release Notes:

- N/A
2025-02-14 18:58:59 +00:00
Conrad Irwin
20460239a0
Fix scroll to top on multibuffer save (#24885)
Co-Authored-By: Cole <cole@zed.dev>

Closes #ISSUE

Release Notes:

- N/A

---------

Co-authored-by: Cole <cole@zed.dev>
2025-02-14 13:18:07 -05:00
Shidfar Hodizoda
7ee492746d
assistant: Add Mistral support (#24879)
Closes #12519.

Release Notes:

- Added support for Mistral to the Assistant.

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
2025-02-14 13:07:41 -05:00
smit
5c5caf1ffe
linux: Fix reload hangs for several minutes (#24882)
Closes #22666

This PR fixes the long wait time to open Zed (2 mins in my case) after
reloading on Linux.

This bug fix is funny:

1. We were using TCP for Zed instances to talk to each other. Reload was
broken here too due to TCP connections not being killed on time.
2. [#11488](https://github.com/zed-industries/zed/pull/11488) PR fixed
the TCP connection issue by adding a wait until it gets killed. I
suppose at that time, this wait time was small.
3. Later, we changed how Zed talks to each other in
[#11585](https://github.com/zed-industries/zed/pull/11585) by using
Datagram and removing TCP. The new approach simply uses a `.sock` file
and a file descriptor to check if some program is listening to it.
4. TCP check is now unnecessary, and it still wait for a long time (I
suppose, TIME_WAIT time, don't quote me on this), even though we don’t
use TCP anymore for this.

This PR just removes that unnecessary TCP wait.

Release Notes:

- Fixed issue where reload hangs for several minutes on Linux.
2025-02-14 21:54:26 +05:30
Cole Miller
39c9b1f170
Gutter-highlight removed and added portions of expanded diff hunks separately (#24834)
cc @iamnbutler 

Release Notes:

- Color gutter highlights separately for removed and deleted portions of
git modification hunks

Co-authored-by: Conrad <conrad@zed.dev>
2025-02-14 10:31:30 -05:00
Agus Zubiaga
4aae0e2f6c
welcome: Try Zed Edit Prediction (#24876)
Release Notes:

- N/A

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Marshall Bowers <git@maxdeviant.com>
2025-02-14 10:28:07 -05:00
Kirill Bulatov
744579ede9
Move git status updates to a background thread #2 (#24722)
Follow-up of https://github.com/zed-industries/zed/pull/24307

Brings back the PR and fixes the issue with the git status not
propagated, if computed too slow.
Now, git repo update
* waits in the background for all `scan_dir` repo status updates and
triggers another status update send afterwards
* ensures that the update sent is reported correctly (`scanning = true`)
if either FS or status scan is running still
* during worktree's git statuses updates, bumps `status_scan_id` to
ensure the repo update is reported to all subscribers

Release Notes:

- Improved project panel's speed in large projects
2025-02-14 16:47:11 +02:00
Agus Zubiaga
592e8fbffc
edit predictions: Fix cursor popover edit preview panic (#24866)
Release Notes:

- Fixed a panic when displaying a whitespace-only line in the edit
prediction preview

---------

Co-authored-by: Antonio <antonio@zed.dev>
2025-02-14 15:44:45 +01:00
Piotr Osiewicz
a618830aea
project: Fine-grained language server management (#24038)
Closes #ISSUE
https://github.com/zed-industries/zed/pull/23804
Release Notes:

- Improved detection of project roots for use by language servers.

Closes #ISSUE

Release Notes:

- N/A *or* Added/Fixed/Improved ...

---------

Co-authored-by: smit <0xtimsb@gmail.com>
Co-authored-by: Henrikh Kantuni <henrikh.kantuni@gmail.com>
Co-authored-by: Caleb! <48127194+kaf-lamed-beyt@users.noreply.github.com>
Co-authored-by: Marshall Bowers <git@maxdeviant.com>
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Co-authored-by: Agus Zubiaga <agus@zed.dev>
Co-authored-by: Danilo <danilo@zed.dev>
Co-authored-by: Nate Butler <iamnbutler@gmail.com>
2025-02-14 15:41:49 +01:00
Agus Zubiaga
8d839fca06
edit predictions: Fix manually requesting completions (#24860)
We were disabling edit predictions altogether when
`show_edit_predictions` was set to `false`. However, even in that case,
`editor::ShowEditPrediction` is supposed to let your request a
prediction manually.

Release Notes:

- Fixed `editor::ShowEditPrediction` when `show_edit_predictions` is set
to `false`.
2025-02-14 10:44:28 -03:00
Sanjeev Shrestha
79ee01eb14
theme: Fix icon theme switching changing the theme (#24849)
Closes #24846 

Release Notes:

- Fixed an issue where changing the icon theme would change the theme.
2025-02-14 08:14:00 -05:00
Kirill Bulatov
3b91de8003
Adds a way to toggle font size without settings adjustments (#24857)
Closes https://github.com/zed-industries/zed/issues/23505

Now `zed::IncreaseBufferFontSize` (and all the same UI- and
Buffer-related settings) action is parameterized with `{ "persist": true
}` (default).
Using `"persist": false` brings back resizing behavior prior to
https://github.com/zed-industries/zed/pull/23265


Release Notes:

- Added a way to toggle font size without settings adjustments
2025-02-14 13:27:48 +02:00
Cole Miller
2f734cbd5e
Fix missing hunks in project diff (#24847)
Release Notes:

- N/A
2025-02-14 01:07:07 -05:00
Mikayla Maki
5d26ce14d7
Centralize the CopyPath and CopyRelativePath actions to zed_actions (#24836)
I spent an hour with @marcospb19 this morning debugging an issue with
adding `Copy Path` and `Copy Relative Path` actions to the editor
context menu. Turned out that the problem was using
`workspace::CopyPath` in the menu and `editor::CopyPath` in the action
handler.

This is an easy mistake to make, so let's fix it for everyone.

Release Notes:

- N/A
2025-02-13 23:30:44 +00:00
Marshall Bowers
c38deb1430
zeta: Remove predict-edits-launch feature flag (#24829)
This PR removes the `predict-edits-launch` feature flag that was added
in #24720.

We don't need this anymore now that we've launched!

Release Notes:

- N/A
2025-02-13 21:48:09 +00:00
Marshall Bowers
8af54c589b
zeta: Update URL to edit prediction blog post (#24828)
This PR updates the URL to the edit prediction blog post.

Release Notes:

- N/A
2025-02-13 21:03:26 +00:00
Nate Butler
8c202b3b09
editor: Update git hunk indicators to show staging status when hunk is expanded (#24818)
- Update git hunk indicators to show staging status when hunk is
expanded
- Updates uses of status colors to the new version control theme colors
- Adds new version control theme colors to included themes

Before:

![CleanShot 2025-02-13 at 14 42
48@2x](https://github.com/user-attachments/assets/ccca147e-0de2-4e69-9cd4-01b010bf06d0)

After:

![CleanShot 2025-02-13 at 14 42
04@2x](https://github.com/user-attachments/assets/1ab49174-bde5-43b2-83c5-d217533df49a)

(Colors here are from before theme colors were added)


Release Notes:

- N/A *or* Added/Fixed/Improved ...

---------

Co-authored-by: cole-miller <m@cole-miller.net>
2025-02-13 20:12:23 +00:00
Cole Miller
a6a8d79d86
Rework hunk controls (#24814)
- Remove prev hunk arrow
- Replace next hunk arrow with "Skip" labelled button
- New "Stage"/"Unstage" labelled button

cc @iamnbutler 

Release Notes:

- N/A

---------

Co-authored-by: Nate <nate@zed.dev>
Co-authored-by: Nate Butler <iamnbutler@gmail.com>
2025-02-13 19:38:20 +00:00
Marshall Bowers
74e8164cd7
collab: Remove POST /snowflake/events endpoint (#24817)
This PR removes the `POST /snowflake/events` endpoint that was added in
#23842, as it is no longer used.

Release Notes:

- N/A
2025-02-13 14:31:57 -05:00
Agus Zubiaga
16ffddf48d
edit predictions: Prefer keybinding with least modifiers when not in conflict mode (#24812)
This workaround a gpui issue where we don't pick the right keybinding

Release Notes:

- N/A
2025-02-13 17:15:53 +00:00
Conrad Irwin
2f741c8686
vim: Fix :wq in multibuffer (#24603)
Supercedes #24561
Closes #21059

Before this change we would skip saving multibuffers regardless of the
save intent. Now we correctly save them.

Along the way:
* Prompt to save when closing the last singleton copy of an item (even
if it's still open in a multibuffer).
* Update our file name prompt to pull out dirty project items from
multibuffers instead of counting multibuffers as untitled files.
* Fix our prompt test helpers to require passing the button name instead
of the index. A few tests were passing invalid responses to save
prompts.
* Refactor the code a bit to hopefully clarify it for the next bug.

Release Notes:

- Fixed edge-cases when closing multiple items including multibuffers.
Previously no prompt was generated when closing an item that was open in
a multibuffer, now you will be prompted.
- vim: Fix :wq in a multibuffer
2025-02-13 17:13:43 +00:00
Cole Miller
8c780ba287
Fix branches with slashes in their names not being listed (#24809)
`refs/heads/*` doesn't match e.g. `refs/heads/cole/branch-with-slash`
(thanks fnmatch), but `refs/heads/**/*` does. This also works for
several levels of slash.

Release Notes:

- N/A
2025-02-13 15:32:23 +00:00
Cole Miller
de0d9d678e
Save open buffers before staging or unstaging their backing files (#24767)
Release Notes:

- N/A
2025-02-13 15:07:28 +00:00
Agus Zubiaga
2db5eed840
edit predictions: Do not use conflict context for other providers (#24807)
This is to avoid confusing copilot/supermaven users when the cursor is
on leading whitespace.

Release Notes:

- N/A
2025-02-13 14:59:52 +00:00
Agus Zubiaga
c3afeda80b
Make edit prediction bindings backwards compatible with existing user keymaps (#24802)
Release Notes:

- N/A

---------

Co-authored-by: Antonio <antonio@zed.dev>
2025-02-13 14:22:08 +00:00
Conrad Irwin
d57f5937d4
Git panel: Right click menu (#24787)
Release Notes:

- N/A
2025-02-12 22:26:34 -07:00
Joseph T. Lyons
fc7bf7bcb9
Bump Zed to v0.175 (#24785)
Release Notes:

-N/A
2025-02-12 23:14:45 -05:00
tidely
5d634245a2
remote_server: Remove unnecessary Box, prevent time-of-check time-of-use bug (#24730)
The MultiWrite struct is defined in the function scope and is allowed to
have a concrete type, which means we can throw away the extra Box.
PathBuf::exists is known to be prone to invalid usage. It doesn't take
into account permissions errors and just returns false, additionally it
introduces a time-of-check time-of-use bug. While extremely unlikely,
why not fix it anyway.

Release Notes:

- remove unnecessary Box
- prevent time-of-check time-of-use bug
2025-02-12 20:55:22 -07:00
Conrad Irwin
21a1541a70
Branch/co-authors in commit (#24768)
- **branch selector in commit box**
- **TEMP**
- **Add co-authors toggle button**

Closes #ISSUE

Release Notes:

- N/A *or* Added/Fixed/Improved ...

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
2025-02-12 20:53:52 -07:00
Max Brunsfeld
71867096c8
Migrate edit_prediction_provider setting before updating its value to 'zed' during onboarding (#24781)
This fixes a bug where we'd update your settings to an invalid state if
you were using the old `inline_completion_provider` setting, then
onboarded to Zeta, then migrated your settings.

Release Notes:

- N/A

Co-authored-by: Michael Sloan <mgsloan@gmail.com>
Co-authored-by: Agus Zubiaga <hi@aguz.me>
2025-02-13 02:35:25 +00:00
Danilo Leal
3d68dba696
edit predictions: Iterate on onboarding modal copywriting (#24779)
Release Notes:

- N/A

---------

Co-authored-by: Nathan Sobo <1789+nathansobo@users.noreply.github.com>
2025-02-13 02:07:20 +00:00
Michael Sloan
a13c2baa7f
Improve error message for AcceptEditPredictions - add docs link (#24772)
The docs have not been updated yet, this is anticipating their presence
soon.


![image](https://github.com/user-attachments/assets/bbcf56f2-6d5b-460b-8ed0-36bef3b4f12f)

Release Notes:

- N/A
2025-02-12 17:46:53 -07:00
Michal Vrbata
7ba1492f0a
file_icons: Add separate icon key for Bicep files (#24757)
This PR adds support for bicep file icon:

Release Notes:

- Icon themes: Added the ability to change the file icon for Bicep
(`.bicep`) files.
2025-02-13 00:36:27 +00:00
Danilo Leal
0a681225b6
edit predictions: Enable blog post link behind a feature flag (#24720)
This PR updates the blog post link in the onboarding modal to be behind
the `predict-edits-launch` feature flag instead of a staff flag.

This will allow us to enable the blog post link once we're live.

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
2025-02-12 23:59:06 +00:00
Marshall Bowers
277fb54632
zeta: Respect x-zed-minimum-required-version header (#24771)
This PR makes it so Zeta respects the `x-zed-minimum-required-version`
header sent back from the server.

If the current Zed version is strictly less than the indicated minimum
required version, we show an error indicating that an update is required
in order to continue using Zeta:

<img width="472" alt="Screenshot 2025-02-12 at 6 15 44 PM"
src="https://github.com/user-attachments/assets/51b85dff-23a0-464c-ae4b-5b8f46b5915c"
/>

Release Notes:

- N/A
2025-02-12 23:58:38 +00:00
Mikayla Maki
b014afa938
Add an undo button to the git panel (#24593)
Also prep infrastructure for pushing a commit

Release Notes:

- N/A

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Co-authored-by: Conrad <conrad@zed.dev>
Co-authored-by: Nate Butler <iamnbutler@gmail.com>
2025-02-12 15:57:08 -07:00
Ben Kunkle
df8adc8b11
Fix linux zeta modifiers display (#24764)
Improves rendering of Zeta keybind shortcuts on Linux

Before:

![image](https://github.com/user-attachments/assets/9b6a61f7-dade-480f-a864-acdcede05957)

After: (with muting modifier changes merged)

![image](https://github.com/user-attachments/assets/dd616d29-ac2e-4c8b-bf9b-5d74f8e4f1c4)


Release Notes:

- N/A

---------

Co-authored-by: Michael <michael@zed.dev>
Co-authored-by: Agus <agus@zed.dev>
2025-02-12 14:46:42 -08:00
smit
522b8d662c
editor: Fix autoscroll flickering regression (#24758)
This PR fixes autoscroll flickering issue caused by recent
[#24735](https://github.com/zed-industries/zed/pull/24735) which fixes
soft wrap scroll issues. No release notes, as this was few hours ago.

Adding vertical scrollbar width to viewport width, so that autoscroll
function don't try to that much pixels extra.

Release Notes:

- N/A
2025-02-13 03:42:22 +05:30
smit
5dc3c237eb
workspace: Do not reuse window for sub directory (only for root directory and sub files) (#24560)
Closes #10232

Context:

We have three ways to open files or dirs in Zed: `zed`, `zed --new`, and
`zed --add`. `--new` forces the project to open in a new window, while
`--add` forces it to open in an existing window (even if the dir isn’t a
subdir of an existing project or the file isn’t part of it).

Using just `zed` tries to open it in an existing window based on similar
logic of `--add`, but if no related project is found the dir, opens in a
new window.

Problem:

Right now, subdirs that are part of an existing project open in the
existing window when using `zed`. By default, subdirs should open in a
new window instead. If someone wants to open it in the existing window,
they can explicitly use `--add`. After this PR, only root dir and files
will focus on existing window, when `zed ` is used.

Fix:

For the `zed` case, we’ve filtered out subdirs in the logic that assigns
them to an existing window.

Release Notes:

- Fixed an issue where subdirectories of an already opened project, when
opened via the terminal, would open in the existing project instead of a
new window.
2025-02-13 03:37:39 +05:30
Agus Zubiaga
c771ca49e1
Fix <1px gap between diff popover and accept keybindingg (#24756)
Release Notes:

- N/A

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: rtfeldman <oss@rtfeldman.com>
Co-authored-by: mgsloan <mgsloan@gmail.com>
2025-02-12 20:59:11 +00:00
Cole Miller
ab4a6f1c79
Open git panel when deploying project diff via action (#24751)
Release Notes:

- N/A
2025-02-12 15:37:17 -05:00
Max Brunsfeld
316b97d6e3
Position prediction popover adjacent to edit if possible (#24750)
Also, place accept key binding indicator on right edge of popover to
avoid obscuring content above.

Release Notes:

- N/A

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: rtfeldman <oss@rtfeldman.com>
Co-authored-by: Agus Zubiaga <hi@aguz.me>
2025-02-12 12:11:49 -08:00
Cole Miller
eea6b526dc
Implement staging and unstaging hunks (#24606)
- [x] Staging hunks
- [x] Unstaging hunks
- [x] Write a randomized test
- [x] Get test passing
- [x] Fix existing bug in diff_base_byte_range computation
- [x] Remote project support
- [ ] ~~Improve performance of
buffer_range_to_unchanged_diff_base_range~~
- [ ] ~~Bug: project diff editor scrolls to top when staging/unstaging
hunk~~ existing issue
- [ ] ~~UI~~ deferred
- [x] Tricky cases
  - [x] Correctly handle acting on multiple hunks for a single file
- [x] Remove path from index when unstaging the last staged hunk, if
it's absent from HEAD, or staging the only hunk, if it's deleted in the
working copy

Release Notes:

- Add `ToggleStagedSelectedDiffHunks` action for staging and unstaging
individual diff hunks
2025-02-12 19:46:42 +00:00
Finn Evers
ea8da43c6b
ui: Fix keybind sizing for non-default UI font sizes (#24708)
Closes #24597 

This fixes the regression from
00971fbe41
which removed the `text_ui(cx)` - call from the keybinding render. The
removal caused improperly scaled font rendering as shown in the images
below.

This PR reintroduces this behaviour for all cases where `size` is not
set.

| | `main` | With this patch | Parent of
00971fbe41
| --- | ---- | ---- | --- |
| Small font size (10px) | <img width="204" alt="cur_small"
src="https://github.com/user-attachments/assets/2bb1615a-c346-4da5-855c-01894744ee74"
/> | <img width="205" alt="pr_small"
src="https://github.com/user-attachments/assets/26ab70f0-d6ca-439b-aaea-4d6ded4f8f11"
/> | <img width="203" alt="prev_small"
src="https://github.com/user-attachments/assets/92a04008-8408-4a98-83a2-59fdd6e5708a"
/> |
| Large font size | <img width="369" alt="cur_big"
src="https://github.com/user-attachments/assets/8400c205-19b6-479c-a3d1-df12ed4e84da"
/> | <img width="398" alt="pr_big"
src="https://github.com/user-attachments/assets/01f495aa-0be1-4169-ae09-4292b0e638ff"
/> | <img width="389" alt="prev_big"
src="https://github.com/user-attachments/assets/e041a8ea-a958-4a3b-8fef-0f7fe5079c34"
/> |


Release Notes:

- Fixed keybind hints being improperly scaled for custom ui font sizes
2025-02-12 14:17:00 -05:00
smit
cc97f4131b
editor: Fix horizontal scroll when soft wrap is active (#24735)
Closes #22252

This PR fixes the bug introduced in
https://github.com/zed-industries/zed/pull/19495 by:

Problem:

The vertical scrollbar is currently rendered absolutely on top of the
editor. When calculating soft wrap, the editor uses its width to decide
how many words fit on a line. This causes words to overlap with the
vertical scrollbar because it doesn't account for the scrollbar's width.
To fix the overlap, extra overflow is added to the scrollbar, which
solves the issue but creates unnecessary scrolling in soft wrap mode.

Fix:

The editor width is adjusted to account for the scrollbar's width. This
makes sure the correct number of words fit on a line and prevents
overlapping with the scrollbar in soft wrap mode.

Since the scrollbar width is now accounted for in the editor's width,
there's no need to add extra overflow, unless there’s no soft wrap. In
that case, when text overflows the editor’s width, we still need to add
extra overscroll to match the scrollbar width. Without this, long lines
will overlap with the scrollbar.

Release Notes:

- Fixed issue where horizontal scrollbar would scroll few characters
width when soft wrap is active.
2025-02-12 22:52:22 +05:30
Piotr Osiewicz
ba7d2ba8c7
project: Activate buffer_diff/test-support in test-support (#24739)
Closes #ISSUE

Release Notes:

- N/A
2025-02-12 16:51:47 +00:00
Agus Zubiaga
553cc2cca5
edit predictions: Do not require modifier if in leading space but just accepted a prediction (#24733)
This makes the tab tab tab experience smoother

Release Notes:

- N/A

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: as-cii <as-cii@zed.dev>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Ben <ben@zed.dev>
2025-02-12 16:30:58 +00:00
Marshall Bowers
3f95d79fc5
inline_completion_button: Put "Eager Preview Mode" menu entry behind a feature flag (#24734)
This PR puts the "Eager Preview Mode" menu entry behind a feature flag
rather than a staff flag.

Currently it defaults to `false` for staff so that it doesn't leak into
any marketing/launch materials.

Folks who want to see it can opt-in to the flag explicitly, for now.

Release Notes:

- N/A
2025-02-12 16:23:23 +00:00