Commit graph

20620 commits

Author SHA1 Message Date
Bennet Bo Fenner
a709d4c7c6
assistant: Add support for claude-3-7-sonnet-thinking (#27085)
Closes #25671

Release Notes:

- Added support for `claude-3-7-sonnet-thinking` in the assistant panel

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Agus Zubiaga <hi@aguz.me>
2025-03-21 12:29:07 +00:00
Kirill Bulatov
2ffce4f516
Add non-blob columns to SQLite (#27236) 2025-03-21 12:04:59 +02:00
Smit Barmase
33fc1f4af2
languages: Fix JS/TS imports not showing correct suggestions after using period (#27235)
Closes #21728

This PR improves autocomplete for imports for all kinds of javascript
and typescript files.

Adds `.` as `completion_query_characters` which will make it act like
word for auto completion context. This allows capturing compete
`format.` as query.

Before:
<img width="500" alt="image"
src="https://github.com/user-attachments/assets/849fb342-db73-48e7-a9d8-93f0e5a14b58"
/>

After:
<img width="500" alt="image"
src="https://github.com/user-attachments/assets/e3ac3272-3217-4bcd-857f-4a83afc5980e"
/>

Release Notes:

- Improved autocomplete suggestions for JavaScript and TypeScript
imports.
2025-03-21 15:13:31 +05:30
David Barsky
7ade7d8e45
lsp-config: Allow setting a server's environment variables (#27213)
Closes https://github.com/zed-industries/zed/issues/14334, allowing
users to set environment variables for a language server binary like:

```json
"lsp": {
  "rust-analyzer": {
    "binary": {
      "path": "/Users/dbarsky/.cargo/bin/rust-analyzer",
      "env": {
        "RA_PROFILE": "*>100"
      }
    },
  }
}
```

The newly introduced environment variables are merged with the shell
environment. Perhaps more controversially, I've _also_ removed the
trimming/`stderr:`-prefixing of language server logs. This because
rust-analyzer has some nice, tree-shaped profiling built-in, and it
prevents us from printing profiles like this:

<details>
<img width="1147" alt="Screenshot 2025-03-20 at 12 09 14 PM"
src="https://github.com/user-attachments/assets/b7066651-6394-492b-b745-906c66d3c7b2"
/>
</details>

Release Notes:

- Added the ability to set a language server's environment variables.
- Removed the `stderr`-prefix of a language server's stderr logs.
2025-03-21 09:15:41 +02:00
Danilo Leal
8f86cd758a
assistant2: Add design refinements (#27160)
Release Notes:

- N/A

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Agus Zubiaga <hi@aguz.me>
2025-03-21 03:19:41 -03:00
迷渡
962709f42c
docs: Change render function's return type (#27229) 2025-03-20 22:48:22 -06:00
Cole Miller
cf7d639fbc
Migrate most callers of git-related worktree APIs to use the GitStore (#27225)
This is a pure refactoring PR that goes through all the git-related APIs
exposed by the worktree crate and minimizes their use outside that
crate, migrating callers of those APIs to read from the GitStore
instead. This is to prepare for evacuating git repository state from
worktrees and making the GitStore the new source of truth.

Other drive-by changes:

- `project::git` is now `project::git_store`, for consistency with the
other project stores
- the project panel's test module has been split into its own file

Release Notes:

- N/A

---------

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2025-03-21 00:10:17 -04:00
Smit Barmase
9134630841
extensions: Add copy author info button in context menu (#27221)
Closes #26108

Add "Copy Author Info" button to extension context menu.

Release Notes:

- Added option to copy extension author's name and email from extension
context menu.
2025-03-21 03:45:06 +05:30
Cole Miller
bc1c0a2297
Separate repository state synchronization from worktree synchronization (#27140)
This PR updates our DB schemas and wire protocol to separate the
synchronization of git statuses and other repository state from the
synchronization of worktrees. This paves the way for moving the code
that executes git status updates out of the `worktree` crate and onto
the new `GitStore`. That end goal is motivated by two (related) points:

- Disentangling git status updates from the worktree's
`BackgroundScanner` will allow us to implement a simpler concurrency
story for those updates, hopefully fixing some known but elusive bugs
(upstream state not updating after push; statuses getting out of sync in
remote projects).
- By moving git repository state to the project-scoped `GitStore`, we
can get rid of the duplication that currently happens when two worktrees
are associated with the same git repository.

Co-authored-by: Max <max@zed.dev>

Release Notes:

- N/A

---------

Co-authored-by: Max <max@zed.dev>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2025-03-20 18:07:03 -04:00
Marshall Bowers
700af63c45
assistant2: Watch settings for changes to profiles (#27219)
This PR makes it so we watch the settings and update when the profiles
change.

Release Notes:

- N/A
2025-03-20 21:12:58 +00:00
Marshall Bowers
4b5df2189b
assistant2: Allow creating agent profiles via settings (#27216)
This PR adds support for creating new agent profiles via the settings:

```json
{
  "assistant": {
    "profiles": {
      "lua": {
        "name": "Lua",
        "tools": {
          "lua-interpreter": true
        }
      },
      "lua-thinking": {
        "name": "Lua + Thinking",
        "tools": {
          "lua-interpreter": true,
          "thinking": true
        }
      }
    }
  }
}
```

Release Notes:

- N/A
2025-03-20 20:30:07 +00:00
Kirill Bulatov
9609e04bb2
Add a way to copy with the selections trimmed (#27206)
No default binding currently, `cmd/ctr-shift-c` seem somewhat natural
but those are occupied by the collab panel.


https://github.com/user-attachments/assets/702cc52a-a4b7-4f2c-bb7f-12ca0c66faeb


Release Notes:

- Added a way to copy with the selections trimmed

---------

Co-authored-by: Cole Miller <m@cole-miller.net>
2025-03-20 19:58:51 +00:00
Anthony Eid
a74f2bb18b
Reuse values from last debug panel inert state if they exist (#27211)
This should allow the team to iterate faster when using the debug panel
to set up a session

Release Notes:

- N/A
2025-03-20 18:53:11 +00:00
Remco Smits
ac452799b0
debugger: Fix shutdown issues (#27071)
This PR fixes a few issues around shutting down a debug adapter.

The first issue I discovered was when I shut down all sessions via
`shutdown all adapters` command. We would still fetch the threads
request again, because we receive a thread event that indicated that it
exited. But this will always time out because the debug adapter is
already shutdown at this point, so by updating the check so we don't
allow fetching a request when the session is terminated fixes the issue.

The second issue fixes a bug where we would always shut down the parent
session, when a child session is terminated. This was reintroduced by
the big refactor. This is not something we want, because you could
receive multiple StartDebugging reverse requests, so if one child is
shutting down that does not mean the other ones should have been
shutting down as well.
Issue was original fixed in
https://github.com/RemcoSmitsDev/zed/pull/80#issuecomment-2573943661.


## TODO:
- [x] Add tests

Release Notes:

- N/A
2025-03-20 18:32:37 +00:00
Smit Barmase
7b80cd865d
Show more possible matches in code context completion (#27199)
Closes #24794

We now don't filter matches provided by the fuzzy matcher, as it already
performs most of the filtering for us. Instead, the custom logic we
previously used for filtering is now used to partition, where before
discarded matches will be appended at end of list.

Before - Filtering out matches with higher fuzzy score
<img width="400" alt="image"
src="https://github.com/user-attachments/assets/7f9d66a2-0921-499c-af8a-f1e530da50b1"
/>

After - Changing filter to partition instead, and appending remaining
items at the end
<img width="400" alt="image"
src="https://github.com/user-attachments/assets/45848f70-ed51-4935-976c-6c16c5b5777b"
/>


Release Notes:

- Improved LSP auto complete to show more possible matches.

---------

Co-authored-by: Peter Tripp <petertripp@gmail.com>
2025-03-20 23:46:20 +05:30
Joseph T. Lyons
7931b1d345
Pre-fill body of email with system specs (#27210)
I think we still want to be able to easily capture system spec info from
users. They can decide if they want to include it or not.

Release Notes:

- N/A
2025-03-20 18:09:10 +00:00
Marshall Bowers
27ebedf517
gpui: Make App::get_name return an Option (#27209)
This PR makes `App::get_name` return an `Option` instead of panicking if
the name is not set.

We'll let the caller be responsible for dealing with the absence of a
name.

Release Notes:

- N/A
2025-03-20 17:56:27 +00:00
Marshall Bowers
f9f5126d2c
assistant2: Uniquely identify context server entries in configuration view (#27207)
This PR gives each context server entry in the configuration view a
unique element ID.

This fixes some issues where the disclosures and switches weren't
working properly due to element ID collisions.

Release Notes:

- N/A
2025-03-20 17:37:15 +00:00
Agus Zubiaga
6408ae81d1
assistant2: Return no-edits response to architect model (#27200)
Sometimes the editor model returns no search/replace blocks. This
usually happens when the architect model calls the edit tool before
reading any files. When this happens, we'll now return the raw response
from the editor model to the architect model so it can recover
accordingly.

Release Notes:

- N/A
2025-03-20 14:29:34 -03:00
Marshall Bowers
c60a7034c8
context_server: Interpret context server command paths relative to the extension's work dir (#27201)
This PR fixes an issues where the commands returned from context server
extensions were being used as-is instead of interpreting them relative
to the extension's work dir.

Release Notes:

- Fixed an issue with context server paths not being interpreted
relative to the extension's work dir.

---------

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Thomas Mickley-Doyle <tmickleydoyle@gmail.com>
2025-03-20 16:36:40 +00:00
Antonio Scandurra
7feb50fafe
Add UI feedback for checkpoint restoration (#27203)
Release Notes:

- N/A

Co-authored-by: Agus Zubiaga <hi@aguz.me>
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2025-03-20 16:35:44 +00:00
Antonio Scandurra
f365b80814
Avoid polluting branch list and restore parent commit when using checkpoints (#27191)
Release Notes:

- N/A
2025-03-20 15:00:23 +00:00
Joseph T. Lyons
d0641a38a4
Rework feedback modal (#27186)
After our last community sync, we came to the conclusion that feedback
being sent outside of email is difficult to reply to. Our decision was
to use the old, tried and true email system, so that we can better
respond to people asking questions.

<img width="392" alt="SCR-20250320-igub"
src="https://github.com/user-attachments/assets/f1d01771-30eb-4b6f-b031-c68ddaac5700"
/>

Release Notes:

- N/A

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2025-03-20 10:28:43 -04:00
Agus Zubiaga
2e8c0ff244
assistant edit tool: Report when file is empty or doesn't exist (#27190)
Instead of just reporting a search match failure, we'll now indicate
whether the file is empty or exists to help the model recover better
from bad edits.


Release Notes:

- N/A
2025-03-20 10:42:10 -03:00
Danilo Leal
4421bdd12e
assistant: Dismiss model picker upon selection (#27162)
This PR makes the model picker close when you click on a new item.

Release Notes:

- N/A
2025-03-20 10:22:49 -03:00
Richard Feldman
e3578fc44a
Display what the tool is doing (#27120)
<img width="639" alt="Screenshot 2025-03-19 at 4 56 47 PM"
src="https://github.com/user-attachments/assets/b997f04d-4aff-4070-87b1-ffdb61019bd1"
/>

Release Notes:

- N/A

---------

Co-authored-by: Agus Zubiaga <hi@aguz.me>
2025-03-20 09:16:39 -04:00
Kirill Bulatov
aae81fd54c
Notify about broken task file contents (#27185)
Closes https://github.com/zed-industries/zed/issues/23783


https://github.com/user-attachments/assets/df019f68-a76b-4953-967a-a35ed21206ab

Release Notes:

- Added notifications when invalid tasks.json/debug.json is saved
2025-03-20 13:06:10 +00:00
Kirill Bulatov
de99febd9b
debugger: Ensure both debug and regular global tasks are correctly merged (#27184)
Follow-up of https://github.com/zed-industries/zed/pull/13433
Closes https://github.com/zed-industries/zed/issues/27124
Closes https://github.com/zed-industries/zed/issues/27066

After this change, both old global task source, `tasks.json` and new,
`debug.json` started to call for the same task update method:


14920ab910/crates/project/src/task_inventory.rs (L414)

erasing previous declarations.

The PR puts this data under different paths instead and adjusts the code
around it.

Release Notes:

- Fixed custom tasks not shown
2025-03-20 12:51:26 +00:00
Kirill Bulatov
5bef32f3ed
When determining Python task context, do not consider worktree-less files as an error (#27183)
Makes Python plugin to output


![image](https://github.com/user-attachments/assets/4960bc48-21b7-4392-82b9-18bfd1dd9cd0)

for standalone Python files now, instead of nothing as now.

Before the change, no task context was created for the standalone file
due to `VariableName::RelativeFile` lookup considered as an error.
Now, Zed continues and constructs whatever possible context instead.

That `pytest` task seems odd, as the logic fixed here needs a relative
path (hence, a worktree) to consider unit tests.
We do not have variables at the moment the associated tasks are queried
for:


14920ab910/crates/languages/src/python.rs (L359-L363)


14920ab910/crates/languages/src/python.rs (L417-L446)

so we cannot filter this the same way the PR does.
Maybe, we can use a `VariableName::RelativeFile` instead of
`VariableName::File` there?

Release Notes:

- Show tasks from Python plugin for standalone files
2025-03-20 12:44:07 +00:00
Smit Barmase
23e8519057
Add completion_query_characters in language (#27175)
Closes #18581

Now characters for completing query and word characters, which are
responsible for selecting words by double clicking or navigating, are
different. This fixes a bunch of things:

For settings.json, this improves completions to treat the whole string
as a completion query, instead of just the last word. We now added
"space" as a completion query character without it being a word
character.

For keymap.json, this improves selecting part of an action as the ":"
character is only a completion character and not a word character. So,
completions would still trigger on ":" and query capture will treat ":"
as a word, but for actions like selections and navigation, ":" will be
treated as punctuation.

Before:
Unnecessary related suggestions as query is only the last word which is
"d".
<img width="300" alt="image"
src="https://github.com/user-attachments/assets/8199a715-7521-49dd-948b-e6aaed04c488"
/>

Double clicking `ToggleFold` selects the whole action:
<img width="300" alt="image"
src="https://github.com/user-attachments/assets/c7f91a6b-06d5-45b6-9d59-61a1b2deda71"
/>

After:
Now query is "one d" and it shows only matched ones.
<img width="300" alt="image"
src="https://github.com/user-attachments/assets/1455dfbc-9906-42e8-b8aa-b3f551194ca2"
/>

Double clicking `ToggleFold` only selects part of the action, which is
more refined behavior.
<img width="300" alt="image"
src="https://github.com/user-attachments/assets/34b1c3c2-184f-402f-9dc8-73030a8c370f"
/>

Release Notes:

- Improved autocomplete suggestions in `settings.json`, now whole string
is queried instead of just last word of string, which filters out lot of
false positives.
- Improved selection of action in `keymap.json`, where now you can
double click to only select certain part of action, instead of selecting
whole action.

---------

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Ben Kunkle <ben@zed.dev>
2025-03-20 16:45:35 +05:30
Michael Sloan
1180b6fbc7
Initial support for AI assistant rules files (#27168)
Release Notes:

- N/A

---------

Co-authored-by: Danilo <danilo@zed.dev>
Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Thomas <thomas@zed.dev>
2025-03-20 08:30:04 +00:00
Ben Kunkle
274124256d
Fix code action formatters creating separate transaction (#26311)
Closes #24588
Closes #25419

Restructures `LspStore.format_local` a decent bit in order to make how
the transaction history is preserved more clear, and in doing so fix
various bugs with how the transaction history is handled during a format
request (especially when formatting in remote dev)

Release Notes:

- Fixed an issue that prevented formatting from working when working
with remote dev
- Fixed an issue when using code actions as a format step where the
edits made by the code actions would not be grouped with the other
format edits in the undo history
2025-03-19 20:59:43 -05:00
Agus Zubiaga
dfdca540ec
assistant2: Handle empty tool results by providing placeholder text (#27130)
This is surprising, but the Anthropic API returns a 400 if a tool output
is an empty string because it thinks we're attaching a `tool use`
without a corresponding `tool result`, but we are not, it's just empty
(which seems totally reasonable) 🙃

Release Notes:

- N/A
2025-03-19 22:30:49 +00:00
Angelo Verlain Shema
c30fb5f1ec
Use shell script language for APKBUILD files (#27099)
`APKBUILD` files are similar to `PKGBUILD` used by arch linux, but are
used to build alpine linux packages:
https://wiki.alpinelinux.org/wiki/APKBUILD_Reference

Release Notes:

- Added recognition for `APKBUILD` files as "Shell Script".
2025-03-19 22:00:44 +00:00
Marshall Bowers
efd3f8a8f1
assistant2: Add initial concept of profiles (#27123)
This PR adds the initial concept of agent profiles to Assistant 2.

Right now these are just collections of tools that can quickly be
enabled together:


https://github.com/user-attachments/assets/7c7f9cc8-a5e5-492f-96f7-79697bbf3d72

There are currently two profiles:

- `Read-only` - Consists only of tools that do not perform writes.
- `Code Writer` - Consists of all tools for writing code, with the
exception of the `lua-interpreter`.

Release Notes:

- N/A
2025-03-19 21:48:14 +00:00
Michael Sloan
3ec69a5bc0
Make getting keybinding for display more efficient (#27046)
No longer iterates all the matching bindings, and no longer clones the
result.

Release Notes:

- N/A
2025-03-19 20:15:33 +00:00
Antonio Scandurra
33faa66e35
Start on a Git-based review flow (#27103)
Release Notes:

- N/A

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
2025-03-19 19:00:21 +00:00
Marshall Bowers
68262fe7e4
theme: Add fallback colors for version_control.<variant> properties (#27104)
This PR adds fallback colors for the `version_control.<variant>` theme
properties.

This fixes the colors when themes do not provide the properties.

Related to  https://github.com/zed-industries/zed/pull/26951.

Release Notes:

- Added fallback colors for the `version_control.<variant>` theme
properties.
2025-03-19 18:48:35 +00:00
Marshall Bowers
4487dc1064
assistant2: Add a button to open the extensions view to install more context servers (#27095)
This PR adds a new button in the Assistant configuration view to open
the extensions view pre-filtered to extensions that provide context
servers.


https://github.com/user-attachments/assets/3bc77507-c8b8-4bc6-8a17-ab5d8b3b7c8a

Release Notes:

- N/A
2025-03-19 17:48:42 +00:00
Piotr Osiewicz
e03edc2a76
debugger: Do not allow setting breakpoints in buffers without file storage (#27094)
Closes #ISSUE

Release Notes:

- N/A
2025-03-19 18:40:31 +01:00
Marshall Bowers
d722067000
extensions_ui: Add ability to open the extensions view with a pre-selected filter (#27093)
This PR adds the ability to open the extensions view via the `zed:
extensions` action with a pre-selected filter.

The "Install Themes" and "Install Icon Themes" buttons in their
respective selectors take advantage of this to set the filter when
opening the view:


https://github.com/user-attachments/assets/2e345c0f-418a-47b6-811e-cabae6c616d1

Release Notes:

- N/A
2025-03-19 17:26:46 +00:00
Kirill Bulatov
d51cd15e4d
Remove an unused field in Diagnostic from zed.proto (#27091)
Release Notes:

- N/A
2025-03-19 17:15:43 +00:00
Marshall Bowers
9fe243efa5
gpui: Update doc comment for App::new (#27089)
This PR updates the doc comment for the `App::new` method.

Release Notes:

- N/A
2025-03-19 16:51:19 +00:00
Max Brunsfeld
74a39c7263
Make FakeGitRepository behave more like a real git repository (#26961)
This PR reworks the `FakeGitRepository` type that we use for testing git
interactions, to make it more realistic. In particular, the `status`
method now derives the Git status from the differences between HEAD, the
index, and the working copy. This way, if you modify a file in the
`FakeFs`, the Git repository's `status` method will reflect that
modification.

Release Notes:

- N/A

---------

Co-authored-by: Junkui Zhang <364772080@qq.com>
2025-03-19 16:04:27 +00:00
Agus Zubiaga
5f398071b2
assistant2: Skip tool uses without a matching tool result (#27082)
Anthropic API doesn't allow `tool_use` messages without a corresponding
`tool_result`, so we'll skip those when building a request. I'll
separately investigate why we are sending request before the tool result
as that might lead to separate issues, but that might take a while and
this is currently very frustrating.

Release Notes:

- N/A
2025-03-19 15:54:57 +00:00
Marshall Bowers
410a942d57
assistant2: Add ability to start and stop context servers (#27080)
This PR adds the ability to start and stop context servers from within
the configuration view in the Assistant panel:


https://github.com/user-attachments/assets/93c3a7cb-d799-4286-88ba-c13cc26e959a

Release Notes:

- N/A
2025-03-19 15:37:48 +00:00
Joseph T. Lyons
06ffdc6791
Bump Zed to v0.180 (#27083)
Release Notes:

-N/A
2025-03-19 11:33:30 -04:00
Marshall Bowers
394215599a
assistant2: Fix broken merge (#27081)
This PR fixes a broken merge caused by
https://github.com/zed-industries/zed/pull/26987 landing after
https://github.com/zed-industries/zed/pull/26758.

Release Notes:

- N/A
2025-03-19 15:26:19 +00:00
Richard Feldman
e8a40085de
Allow tools to read unsaved buffers (#26987)
If the tool asks to read a path, we don't need to verify whether that
path exists on disk; an unsaved buffer with that path is fine.

Release Notes:

- N/A
2025-03-19 14:59:10 +00:00
Richard Feldman
6303751325
Record token usage telemetry (#26962)
<img width="1103" alt="Screenshot 2025-03-17 at 9 47 32 PM"
src="https://github.com/user-attachments/assets/947cf33d-4464-4305-8ff0-3630529d2f81"
/>


Release Notes:

- N/A
2025-03-19 10:47:46 -04:00