Commit graph

19705 commits

Author SHA1 Message Date
Cole Miller
45146b6f30
Implement staging of partially-staged hunks (#25520)
Closes: #25475 

This PR makes it possible to stage uncommitted hunks that overlap but do
not coincide with an unstaged hunk.

Release Notes:

- Made it possible to stage hunks that are already partially staged

---------

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Max <max@zed.dev>
2025-02-24 23:13:13 -05:00
Conrad Irwin
bcbb19e06e
Fix leaked editor (#25530)
Closes #ISSUE

Release Notes:

- Fixed a bug that would prevent rejoining projects sometimes
2025-02-25 03:10:45 +00:00
Agus Zubiaga
3f168e85c2
edit predictions: Invalidate cached settings and unset provider when set to none (#25505)
Fixes a few state mismatches when changing providers and other settings

Release Notes:

- edit predictions: Fix mismatch between status bar settings and editor
control settings
- edit predictions: Turn off as soon as `edit_prediction_provider` is
set to `none`

---------

Co-authored-by: Danilo <danilo@zed.dev>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2025-02-24 22:56:28 -03:00
5brian
52f73e0c2d
vim: Refactor and fix multiline operations (#25055)
Changes:
- [x] Cursor at the start during yank operations on objects (`yip`,
`yab` etc).
- [x] Refactors this: Trim all leading and trailing whitespace from
inner multiline bracket selection.
  - This leaves a nicely indented line when doing `ci{` `vi{d` etc
  - [x] Checks for empty selection
  - [x] Removed moving cursor to the start in visual bracket operations

This cleans up the previous implementation by providing a simpler check
in `surrounding_markers`, instead of calling a new function in
`expand_object`. No functionality was changed there except for handling
the empty selection and removing some cursor adjustments that should not
have been there after further testing.

Release Notes:

- N/A
2025-02-24 18:30:21 -07:00
RieN 7z
980e1b533f
Fix missing selection range in Vim visual line mode in the assistant panel (#25133)
Closes #25132

Release Notes:

- Fixed issues with `assistant: insert into editor` and `editor: copy` not inserting/copying the correct text inside of the assistant panel when selected using line-wise selection in Vim mode

---------

Co-authored-by: Ben Kunkle <ben.kunkle@gmail.com>
2025-02-25 01:15:15 +00:00
Finn Evers
113c471bb0
rust: Restore and update attribute highlighting (#25501)
#25333 added broader highlighting for identifiers, which broke the
generic query for attribute queries, resulting in these being
highlighted the same as identifiers.

To accomodate for this change, this PR updates the attribute matches to
be more specific.

Additionally, path matches in scoped identifiers are no longer
highlighted as attributes, as seen in the comparison screenshot. Can
revert this if requested.

| Zed Preview | <img width="750" alt="preview"
src="https://github.com/user-attachments/assets/2cd2e830-f510-4adf-8ce9-c41ed6fb157c"
/> |
| --- | --- | 
| `main` | <img width="750" alt="main"
src="https://github.com/user-attachments/assets/cbe93186-9afd-4515-bc06-e519fd4ee6af"
/> |
| This PR | <img width="750" alt="pr"
src="https://github.com/user-attachments/assets/68270de8-e083-4fc6-a45e-25d3151acd87"
/> |

The generic match for `token_tree` is needed to recursively match
patterns like `#[cfg(any(test, feature = "test-support"))]` (or at least
I was unable to find a better query here). I tried to validate that this
does not break any other highlights and I believe it does not. However,
I might have still missed something.

Release Notes:

- N/A
2025-02-24 19:10:30 -05:00
Anthony Eid
10fef92eea
Dismiss git commit modal when it's out of focus (#25518)
Release Notes:

- Fix git commit modal not being dismissed when pressing esc key or
clicking outside the modal
2025-02-25 00:09:46 +00:00
Anthony Eid
3ee4edc404
Fix go to definition split (#24990)
Closes #24982 

Release Notes:

- Fix `GoToDefinitionSplit` action bug where split wouldn't happen if
definition was in the same active editor

---------

Co-authored-by: Dylan <dylwil3@gmail.com>
2025-02-24 18:46:13 -05:00
Shardul Vaidya
eda233344c
assistant: Add Bedrock support (#21092)
Closes #16544

Release Notes:

- Added support for AWS Bedrock to the Assistant.

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
Co-authored-by: Anthony <anthony@zed.dev>
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
2025-02-24 18:10:12 -05:00
Conrad Irwin
7b277d2efd
Fix run indicators jumping when buffer content changes. (#25507)
Co-authored-by: Anthony Eid <hello@anthonyeid.me>

Release Notes:

- Fix run indicators jumping when content changes

---------

Co-authored-by: Anthony Eid <hello@anthonyeid.me>
2025-02-24 22:57:54 +00:00
Conrad Irwin
63cfcc26fb
Fix jumping to multibuffer excerpts from deleted hunks (#25512)
Co-authored-by: Anthony Eid <hello@anthonyeid.me>

Release Notes:

- N/A

Co-authored-by: Anthony Eid <hello@anthonyeid.me>
2025-02-24 15:56:11 -07:00
Conrad Irwin
53a5145dc8
Fix performance of GitPanel::update_visible_entries (#25504)
Co-authored-by: Anthony Eid <hello@anthonyeid.me>

Closes #19022

Release Notes:

- Fixes pessimal performance with the new git panel when a very large
number of files are untracked

Co-authored-by: Anthony Eid <hello@anthonyeid.me>
2025-02-24 15:55:44 -07:00
Marshall Bowers
def342e35c
Remove dependents of language_models (#25511)
This PR removes the dependents of the `language_models` crate.

The following types have been moved from `language_models` to
`language_model` to facilitate this:

- `LlmApiToken`
- `RefreshLlmTokenListener`
- `MaxMonthlySpendReachedError`
- `PaymentRequiredError`

With this change only `zed` now depends on `language_models`.

Release Notes:

- N/A
2025-02-24 22:46:45 +00:00
5brian
bbb8d63de0
vim: Register backquote object (#25502)
Closes #25496

Release Notes:

- vim: Fixed operations on backtick quotes
2025-02-24 15:33:17 -07:00
Marshall Bowers
e5b97a5e48
Move report_assistant_event into language_model crate (#25508)
This PR moves the `report_assistant_event` function from the
`language_models` crate to the `language_model` crate.

This allows us to drop some dependencies on `language_models`.

Release Notes:

- N/A
2025-02-24 22:27:26 +00:00
Cole Miller
e06666759a
Improve performance of project panel with many git statuses (#25465)
Closes #ISSUE

Release Notes:

- Improved performance of project panel in large git repositories
2025-02-24 17:03:52 -05:00
Marshall Bowers
0acd556106
language_model: Remove dependencies on individual model provider crates (#25503)
This PR removes the dependencies on the individual model provider crates
from the `language_model` crate.

The various conversion methods for converting a `LanguageModelRequest`
into its provider-specific request type have been inlined into the
various provider modules in the `language_models` crate.

The model providers we provide via Zed's cloud offering get to stay, for
now.

Release Notes:

- N/A
2025-02-24 16:41:35 -05:00
Agus Zubiaga
2f7a62780a
edit predictions: Refine leading whitespace behavior (#25491)
Closes https://github.com/zed-industries/zed/issues/25406

### Problem

Users have been confused about requiring `alt-tab` instead of just `tab`
in cases where they don't have a completions menu open (see issue
above). When they insert a newline and are in leading whitespace, they
expect to be able to accept a prediction with just `tab`, but doing so
increasing the indentation instead.

This PR changes the behavior in so a modifier is only required if the
cursor isn't already at the right indentation level based on the
surrounding block. In this case, `tab` would increase the indentation
and the prediction would get interpolated, allowing the user to press
`tab` again to accept it.

We also updated the docs to break down this behavior:
https://github.com/zed-industries/zed/pull/25493

### Before


https://github.com/user-attachments/assets/91fe6193-dddd-43c1-8c26-0f4648bdc3fa

### After


https://github.com/user-attachments/assets/671041bf-bf22-46a3-8466-b19b3e7dd6a0


Release Notes:

- edit predictions: Do not require a modifier key when indentation is
correct according to its surrounding block

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2025-02-24 18:37:18 -03:00
Peter Tripp
10a4760f90
Add Anthropic Claude 3.7 support (#25497) 2025-02-24 16:10:26 -05:00
Marshall Bowers
cdd07fdf29
Add aws_http_client and bedrock crates (#25490)
This PR adds new `aws_http_client` and `bedrock` crates for supporting
AWS Bedrock.

Pulling out of https://github.com/zed-industries/zed/pull/21092 to make
it easier to land.

Release Notes:

- N/A

---------

Co-authored-by: Shardul Vaidya <cam.v737@gmail.com>
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
2025-02-24 20:28:20 +00:00
Michael Sloan
8a3fb890b0
Document why ForegroundExecutor is !Send (#25492)
Release Notes:

- N/A
2025-02-24 19:48:59 +00:00
Nate Butler
30af8d0a81
git_ui: Commit modal refinement (#25484)
Closes #ISSUE

Release Notes:

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

---------

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
2025-02-24 19:19:06 +00:00
Agus Zubiaga
ceb7fc2cb2
edit predictions: Split layout_edit_prediction popover (#25463)
This function has grown a lot and it was getting really hard to
navigate. This PR splits it into smaller methods and moves it into
`Editor` with the rest of the edit prediction popovers' code.

I think there are opportunities to consolidate the many popovers we
have, but we'll do that separately.

Release Notes:

- N/A
2025-02-24 16:16:19 -03:00
João Marcos
ec7ce41324
Git: Fix Linux bindings (#25486)
- Tooltip with binding wasn't showing up
- Missing Linux bindings
- Commit modal wasn't opening when binding was pressed

Release Notes:

- N/A

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2025-02-24 18:49:17 +00:00
Mikayla Maki
ff6844300e
Git push/pull/fetch (#25445)
Release Notes:

- N/A

---------

Co-authored-by: Michael Sloan <mgsloan@gmail.com>
2025-02-24 18:29:52 +00:00
Jason Lee
b1b6401ce7
gpui: Don’t hide Window in docs (#25449)
Release Notes:

- N/A

This side effect is only appearing in outside project.

## Before

<img width="414" alt="image"
src="https://github.com/user-attachments/assets/73d215d2-20e4-4337-82f4-74daa88a1bae"
/>

## After

<img width="453" alt="image"
src="https://github.com/user-attachments/assets/030d34d7-c425-44f6-9cc5-0f2f6fd0a1ac"
/>

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
2025-02-24 18:11:46 +00:00
Jason Lee
07ba7c8c44
gpui: Add underline style method (#24784)
Release Notes:

- N/A

Add a shorter method to apply underline style.

https://tailwindcss.com/docs/text-decoration-line#underling-text

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
2025-02-24 12:58:20 -05:00
Conrad Irwin
6516249302
Fix conflict state (was broken by merge conflict) (#25354)
Closes #ISSUE

Release Notes:

- N/A
2025-02-24 10:52:42 -07:00
Danilo Leal
fc8218d728
project panel: Change marked entries behavior and improve state colors (#25457)
Follow up to @0xtimsb's PR
https://github.com/zed-industries/zed/pull/22658.

- We're now changing the marked entry as we change the active buffer via
the pane tabs. If all tabs are closed, we clear all marked entries, too.
That means: if we have no open buffer, we don't have any highlighted
entry (i.e., background color) in the project panel.
- Also, now only marked entries have a different, more distinct
background color. The `is_active` state doesn't change an item's
background color anymore.
- This improves an edge case where you could have multiple entries
marked—where all of them would have a background color—and upon
unmarking one of them, that entry would continue to have a bg color.
Now, once you click or move your focus to unmark that entry, the bg
color goes away.

We discovered some new problems by doing these changes that we want to
fix:
1. If you open a project without any open buffer, focus on the project
panel, navigate with arrows to a given entry, and hit space, you will
mark and open the file in the buffer. This is all correct. If you then
hit `escape` to clear the marked entries, nothing happens to the open
buffer, and the marked styled in the project panel entry go away. This
is all correct. The wrong behavior happens if you now hit space _again_
on the active entry. That should mark it, and thus change its styles,
but it doesn't happen. You just see it upon moving to a different entry
with arrow up/down.
2. If you mark multiple entries on the project panel and then click on
an open buffer, we still see all the multiple entries marked. This feels
incorrect. We should only allow one marked entry at a time.

These fixes should happen in follow up PRs, though.

Release Notes:

- Improved the scenario where there'd be a project panel entry
highlighted/marked even if there is no open buffer.

---------

Co-authored-by: smit <0xtimsb@gmail.com>
2025-02-24 22:44:09 +05:30
Eli Kaplan
a8d56877ee
copilot: Support HTTP/HTTPS proxy for Copilot language server (#24364)
Closes #6701 (one of the top ranking issues as of writing)

Adds the ability to specify an HTTP/HTTPS proxy to route Copilot code
completion API requests through. This should fix copilot functionality
in restricted network environments (where such a proxy is required) but
also opens up the ability to point copilot code completion requests at
your own local LLM, using e.g.:
- https://github.com/jjleng/copilot-proxy
- https://github.com/bernardo-bruning/ollama-copilot/tree/master

External MITM-proxy tools permitting, this can serve as a stop-gap to
allow local LLM code completion in Zed until a proper OpenAI-compatible
local code completions provider is implemented. With this in mind, in
this PR I've added separate `settings.json` variables to configure a
proxy server _specific to the code completions provider_ instead of
using the global `proxy` setting, to allow for cases like this where we
_only_ want to proxy e.g. the Copilot requests, but not all outgoing
traffic from the application.

Currently, two new settings are added:
- `inline_completions.copilot.proxy`: Proxy server URL (HTTP and HTTPS
schemes supported)
- `inline_completions.copilot.proxy_no_verify`: Whether to disable
certificate verification through the proxy

Example:
```js
"features": {
  "inline_completion_provider": "copilot"
},
"show_completions_on_input": true,
// New:
"inline_completions": {
  "copilot": {
    "proxy": "http://example.com:15432",
    "proxy_no_verify": true
  }
}
```


Release Notes:

- Added the ability to specify an HTTP/HTTPS proxy for Copilot.

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
2025-02-24 12:11:00 -05:00
João Marcos
dd0de3cfa9
Git panel: Fix commit binding tooltip not showing up (#25472)
Co-authored by: Conrad <conrad@zed.dev>

Release Notes:

- N/A
2025-02-24 16:41:37 +00:00
João Marcos
d1302a7a08
Diff view: Fold excerpts of deleted files by default (#25436)
Release Notes:

- N/A
2025-02-24 12:52:13 -03:00
João Marcos
2b28b5969f
Remove unused variable distinguish_unstaged_diff_hunks (#25462)
Release Notes:

- N/A
2025-02-24 15:25:13 +00:00
Nikita Pivkin
bc941bfc97
assistant_tools: Rename FileToolInput to NowToolInput (#25456)
Renamed the `FileToolInput` structure to `NowToolInput` to better
reflect its purpose, as the tool is related to time-based operations.

Release Notes:

- N/A

Signed-off-by: Nikita Pivkin <nikita.pivkin@smartforce.io>
2025-02-24 09:37:07 -05:00
Agus Zubiaga
72a9429ef6
edit predictions: Always position jump/accept popovers inside viewport (#25348)
https://github.com/user-attachments/assets/345961c5-9bcb-4ee5-80f2-03d5fd0741d3

Release Notes:

- edit prediction: Fixed jump/accept popover position for long lines

---------

Co-authored-by: Danilo <danilo@zed.dev>
2025-02-24 10:26:29 -03:00
Danilo Leal
f020291039
assistant: Rename action from New Context to New Chat (#25455)
If you looked that up via the Command Palette, we were showing an
outdated action name ("new context") which causes confusion given the
panel says "New Chat".

Release Notes:

- N/A
2025-02-24 09:19:38 -03:00
smit
4b3a2a33a8
vim: Fix auto_indent_on_paste not being respected (#25447)
Closes #12236

This PR fixes an issue where the `auto_indent_on_paste` setting was not
being applied for pasting in Vim mode. It was correctly used for normal
paste behavior.

Also includes tests.  


Release Notes:

- Fixed yank + paste indenting incorrectly when `auto_indent_on_paste`
is set to `false` in certain languages.
2025-02-24 14:59:05 +05:30
张小白
1f257f4704
fs: Fix copy_recursive (#25317)
Closes #24746

This PR modifies the implementation of `copy_recursive`. Previously, we
were copying and pasting simultaneously, which caused an issue when a
user copied a folder into one of its subfolders. This resulted in new
content being created in the folder while copying, and subsequent
recursive calls to `copy_recursive` would continue this process, leading
to an infinite loop.

In this PR, the approach has been changed: we now first collect the
paths of the files to be copied, and only then perform the copy
operation.

Additionally, I have added corresponding tests. On the main branch, this
test would previously run indefinitely.

Release Notes:

- Fixed `copy_recursive` runs infinitely when copying a folder into its
subfolder.
2025-02-24 11:02:14 +02:00
Antonio Scandurra
f517050548
Partially fix assistant onboarding (#25313)
While investigating #24896, I noticed two issues:

1. The default configuration for the `zed.dev` provider was using the
wrong string for Claude 3.5 Sonnet. This meant the provider would always
result as not configured until the user selected it from the model
picker, because we couldn't deserialize that string to a valid
`anthropic::Model` enum variant.
2. When clicking on `Open New Chat`/`Start New Thread` in the provider
configuration, we would select `Claude 3.5 Haiku` by default instead of
Claude 3.5 Sonnet.

Release Notes:

- Fixed some issues that caused AI providers to sometimes be
misconfigured.
2025-02-24 07:29:55 +00:00
Joseph T. Lyons
535ba75bc7
Do not indent on enter in python comments ending in colon (#25437)
Closes https://github.com/zed-industries/zed/issues/25416

Release Notes:

- Fixed a bug where indentation was applied when adding a newline to a
Python comment ending in `:`.
2025-02-24 04:11:22 +00:00
Marshall Bowers
3b3c379852
docs: Fix casing of "Tree-sitter" (#25427)
This PR fixes the casing of "Tree-sitter" in the docs.

It is "Tree-sitter", not "Tree Sitter" or "Tree-Sitter".

Release Notes:

- N/A
2025-02-23 15:30:10 +00:00
Kirill Bulatov
147f407b7a
Fix theme selector resetting the buffer size (#25425)
Closes https://github.com/zed-industries/zed/issues/25413

As the issue points out well, themes do not need to alter any in-memory
state on load: that is done via settings file load.
Originally, it was introduced in
https://github.com/zed-industries/zed/pull/4064 and
https://github.com/zed-industries/zed/pull/24857 had restored that
behavior, which seems wrong to do.

Apart from removing that part, removes unnecessary methods and
emphasizes that in-memory state is the Buffer/UI size — no need to add
`Adjusted` there as the settings file presence is already enough.

Release Notes:

- Fixed theme selector resetting the buffer size
2025-02-23 15:24:43 +00:00
Aivaz Latypov
7e097d529a
zeta: Add LICENSE.md and LICENCE.md to license detection (#25422)
Maybe it's not a very common, but it has a place to be.

Release Notes:

- Added `LICENSE.md` and `LICENCE.md` files to license detection for
edit prediction.

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
2025-02-23 15:08:24 +00:00
Coenen Benjamin
65f76e6f4d
Add support for --target-dir for Rust tasks (#24725)
This PR is an attempt to add support for `--target-dir` argument to
`cargo` commands when executing tasks with rust.
When using VSCode I was already using this trick to not block the
current binary compilation when I was trying a specific test. As it's a
different target directory it won't block the `cargo` commands I'm using
in my terminal.

I used the task variables to achieve this but I'm not sure it's the best
option to be honest. I didn't find any examples in your docs to see if
sometimes you had specific configuration for languages and tasks.

Let me know if this solution would be a good fit and if the
implementation is ok.

If so feel free to redirect me to an example I can reproduce to write a
unit test or so... And I will also update the docs.

Example of config:

```
{
  "languages": {
    "Rust": {
      "tasks": {
        "variables": {
          "RUST_TARGET_DIR": ".cargo_check"
        }
      }
    }
  }
}
```

it will run `cargo test -p XXX --target-dir .cargo-check`


Release Notes:

- Added support for `--target-dir` for Rust tasks

---------

Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com>
2025-02-23 11:05:07 +01:00
Piotr Osiewicz
918cba4cce
lsp: Check for existing snapshots before sending off a didOpen notification (#25409)
Closes #ISSUE

Release Notes:

- Fixed Zed sending out didOpen notification to a language server when
opening documents.
2025-02-23 01:17:46 +01:00
Conrad Irwin
4067ae4b37
Fix stage/unstage buttons on new empty files (#25365)
Closes #ISSUE

Release Notes:

- N/A
2025-02-22 13:49:58 -07:00
Thomas Heartman
084a0233b6
vim: Add exchange (#24678)
Implements [vim-exchange](https://github.com/tommcdo/vim-exchange)
functionality.

Lets you swap the content of one selection/object/motion with another.

The default key bindings are the same as in exchange:
- `cx` to begin the exchange in normal mode. Visual mode does not have a
default binding due to conflicts.
- `cxx` selects the current line
- `cxc` clears the selection
- If the previous operation was an exchange, `.` will repeat that
operation.

Closes #22759

## Overlapping regions

According to the vim exchange readme:

> If one region is fully contained within the other, it will replace the
containing region.

Zed does the following:
- If one range is completely contained within another: the smaller
region replaces the larger region (as in exchange.vim)
- If the ranges only partially overlap, then we abort and cancel the
exchange. I don't think we can do anything sensible with that. Not sure
what the original does, evil-exchange aborts.

## Not implemented: cross-window exchange

Emacs's evil-exchange allows you to exchange across buffers. There is no
code to accommodate that in this PR. Personally, it'd never occurred to
me before working on this and I've never needed it. As such, I'll leave
that implementation for whomever needs it.

As an upside; this allows you to have concurrent exchange states per
buffer, which may come in handy.

## Bonus

Also adds "replace with register" for the full line with `grr` 🐕 This
was an oversight from a previous PR.

Release notes:

- Added an implementation of `vim-exchange`
- Fixed: Added missing default key binding for `Vim::CurrentLine` for
replace with register mode (`grr`)

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2025-02-22 20:36:21 +00:00
Angelk90
abc027558a
Only authenticate if the credentials provider has credentials when running in development (#25403)
Closes #25394

Release Notes:

- N/A

Scenarios:

| Scenarios | What it does |
|------|--------|
| Interactive Terminal + Impersonate Active Login | Login without saved
credentials |
| Interactive Terminal + Saved credentials | Login with saved
credentials |
| Interactive Terminal + No credentials | Does nothing |
| Non-interactive Terminal + Saved credentials | Login with saved
credentials |
| Non-interactive Terminal + No credentials | Does nothing |

@maxdeviant : You can take a look at it.

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
2025-02-22 18:29:27 +00:00
Marshall Bowers
4d106a4b0b
zed_extension_api: Add simple process API (#25399)
This PR adds a simple API for working with processes to the extension
API.

The API is designed to mirror Rust's
[`std::process::Command`](https://doc.rust-lang.org/std/process/struct.Command.html).

Release Notes:

- N/A
2025-02-22 18:05:36 +00:00
Marshall Bowers
ec4d9ec111
zed_extension_api: Use v0.3.0 WIT files for codegen (#25398)
This PR updates the `zed_extension_api` to use the v0.3.0 WIT files for
code generation.

I missed this in https://github.com/zed-industries/zed/pull/25357.

Release Notes:

- N/A
2025-02-22 17:47:57 +00:00