Commit Graph

16746 Commits

Author SHA1 Message Date
Mikayla Maki
455850505f
Fix more bugs in files (#16241)
Fixes:
- [x] an issue where directories would only match by prefix, causing
both a directory and a file to be matched if in the same directory
- [x] An issue where you could not continue a file completion when
selecting a directory, as `tab` on a file would always run the command.
This effectively disabled directory sub queries.
- [x] Inconsistent rendering of files and directories in the slash
command

Release Notes:

- N/A

---------

Co-authored-by: max <max@zed.dev>
2024-08-16 10:09:38 -07:00
Roy Williams
b4f5f5024e
Support 8192 output tokens for Claude Sonnet 3.5 (#16358)
Release Notes:

- Added support for 8192 output tokens from Claude Sonnet 3.5
(https://x.com/alexalbert__/status/1812921642143900036)
2024-08-16 11:47:39 -04:00
Kirill Bulatov
f1a2638d29
Do not enable copilot for always read-only editors (#16356)
Release Notes:

- N/A
2024-08-16 17:22:47 +03:00
Kirill Bulatov
0fe22f2a48
After streaming generation is over, show a regular, batch diff in the file altered (#16350)
Release Notes:

- N/A
2024-08-16 15:31:02 +03:00
Kyle Kelley
f7f5a25584
repl: Apply border for error output on left (#16334) 2024-08-16 00:31:46 -05:00
张小白
40d97fd346
windows: Fix missing title bar on prompt library (#16302)
Closes #16297

It seems that currently we can't draw custom title bar. I have checked
the `title_bar` crate, it seems to be `zed` only.

Before:

![Screenshot 2024-08-16
004350](https://github.com/user-attachments/assets/e11aa0bb-9d3e-47d5-b488-d3b8220158cc)

After:

![Screenshot 2024-08-16
004235](https://github.com/user-attachments/assets/028b4eb2-c878-4ea7-87e3-22817caefa00)


Release Notes:

- N/A
2024-08-15 22:23:11 -06:00
Nathan Sobo
ad44b459cd
Improve content generation prompt to reduce over-generation (#16333)
I focused on cases where we're inserting doc comments or annotations
above symbols.

I added 5 new examples to the content generation prompt, covering
various scenarios:

1. Inserting documentation for a Rust struct
2. Writing docstrings for a Python class
3. Adding comments to a TypeScript method
4. Adding a derive attribute to a Rust struct
5. Adding a decorator to a Python class

These examples demonstrate how to handle different languages and common
tasks like adding documentation, attributes, and decorators.

To improve context integration, I've made the following changes:

1. Added a `transform_context_range` that includes 3 lines before and
after the transform range
2. Introduced `rewrite_section_prefix` and `rewrite_section_suffix` to
provide more context around the section being rewritten
3. Updated the prompt template to include this additional context in a
separate code snippet

Release Notes:

- Reduced instances of over-generation when inserting docs or
annotations above a symbol.
2024-08-15 22:20:11 -06:00
Kyle Kelley
bac39d7743
assistant: Only push text content if not empty with image content (#16270)
If you submit an image with empty space above it and text below, it will
fail with this error:


![image](https://github.com/user-attachments/assets/a4a2265e-815f-48b5-b09e-e178fce82ef7)

Now instead it fails with an error about needing a message.

<img width="640" alt="image"
src="https://github.com/user-attachments/assets/72b267eb-b288-40a5-a829-750121ff16cc">

It will however work with text above and empty text below the image now.

Release Notes:

- Improved conformance with Anthropic Images in Chat Completions API
2024-08-15 22:38:52 -05:00
Roy Williams
46fb917e02
Implement Anthropic prompt caching (#16274)
Release Notes:

- Adds support for Prompt Caching in Anthropic. For models that support
it this can dramatically lower cost while improving performance.
2024-08-15 22:21:06 -05:00
Max Brunsfeld
09b6e3f2a6
Improve workflow step view (#16329)
* Improve the tab title: give it an icon, and indicate the step index.
* Display the line number ranges that the symbols resolve to.
* Don't open duplicate tabs for the same step

Release Notes:

- N/A
2024-08-15 17:45:23 -07:00
Max Brunsfeld
364a58a262
Move context tests into their own file (#16327)
This makes it easier to use the outline view to navigate `context.rs`,
and reduces the indentation level of the tests.

Release Notes:

- N/A
2024-08-15 17:14:05 -07:00
Max Brunsfeld
c896ff292c
Remove workflow inspector, clean up workflow code (#16325)
Now that there's a dedicated, user-facing view for each workflow step,
we don't need the inspector functionality. This PR also cleans up some
naming around workflow steps and step resolutions.

Release Notes:

- N/A
2024-08-15 16:47:29 -07:00
Kyle Kelley
da2bfbd29f
repl: Scale the text_style font_size and line_height (#16308)
Replaces #16273.

Release Notes:

- repl: Fixed scaling of stdout/stderr line heights

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Nate Butler <iamnbutler@gmail.com>
2024-08-15 18:46:36 -05:00
Joseph T. Lyons
0b407164d0
Update assistant docs (#16324)
Release Notes:

- N/A
2024-08-15 18:42:13 -04:00
Marshall Bowers
b151241d84
assistant: Improve the empty state for the prompt library (#16320)
This PR improves the empty state of the prompt library.

The right-hand side of the library is now dedicated to an empty state
that guides the user to create their first prompt.

Additionally, the message in the picker now reads "No prompts." when
there are no prompts.

#### No prompts

<img width="1136" alt="Screenshot 2024-08-15 at 6 20 26 PM"
src="https://github.com/user-attachments/assets/f9af2b5d-c4d3-4e2c-9ba2-f17e89f19bb7">

#### No prompts that match the search

<img width="1136" alt="Screenshot 2024-08-15 at 5 55 07 PM"
src="https://github.com/user-attachments/assets/2cd4ff9b-958d-4bd0-90d3-dca62b1a91a0">

Release Notes:

- N/A
2024-08-15 18:28:17 -04:00
Marshall Bowers
f65b2b9a2d
assistant: Fix toggling the model selector via keybind (#16319)
This PR restores the ability to toggle the model selector via a keybind
after it was lost in #15693.

Release Notes:

- Restored the ability to toggle the model selector in the Assistant via
a keybinding (Preview only).
2024-08-15 17:45:25 -04:00
Max Brunsfeld
776442f3ae
Add a workflow step resolution view (#16315)
You can now click on a step header (the words `Step 3`, etc) to open a
new tab containing a dedicated view for the resolution of that step.
This view looks similar to a context editor, and has sections for the
step input, the streaming tool output, and the interpreted results.

Hitting `cmd-enter` in this view re-resolves the step.


https://github.com/user-attachments/assets/64d82cdb-e70f-4204-8697-b30df5a645d5



Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
2024-08-15 14:16:58 -07:00
Marshall Bowers
583959f82a
collab: Add support for reading boolean values from .env.toml (#16317)
This PR adds support for reading boolean values from `.env.toml`, since
it wasn't supported previously.

Release Notes:

- N/A
2024-08-15 17:07:17 -04:00
Marshall Bowers
9233418cb8
collab: Attach GitHub login to LLM spans (#16316)
This PR updates the LLM service to include the GitHub login on its
spans.

We need to pass this information through on the LLM token, so it will
temporarily be `None` until this change is deployed and new tokens have
been issued.

Release Notes:

- N/A
2024-08-15 17:06:20 -04:00
Marshall Bowers
5e05821d18
collab: Attach user_id to LLM spans (#16311)
This PR updates the LLM service to attach the user ID to the spans.

Release Notes:

- N/A
2024-08-15 15:49:12 -04:00
Kirill Bulatov
ff83e5b55a
Improve workflow suggestion steps and debug info (#16309)
Release Notes:

- N/A

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
2024-08-15 22:46:19 +03:00
Max Brunsfeld
6b7664ef4a
Fix bugs preventing non-staff users from using LLM service (#16307)
- db deadlock in GetLlmToken for non-staff users
- typo in allowed model name for non-staff users

Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Joseph <joseph@zed.dev>
2024-08-15 11:21:19 -07:00
Marshall Bowers
931883aca9
extension: Remove tooltip_text from SlashCommandManifestEntry (#16306)
This PR removes the `tooltip_text` field from
`SlashCommandManifestEntry`s.

The `tooltip_text` is currently only used to set the `menu_text` on a
slash command, which is only used for featured slash commands.

Since slash commands from extensions are not currently able to be
featured, we don't need extension authors to provide this field in the
manifest.

This is a backwards-compatible change.

Release Notes:

- N/A
2024-08-15 13:25:55 -04:00
Marshall Bowers
e982ff7b9e
zed_extension_api: Start a list of pending changes (#16305)
This PR starts a list of pending changes for the Zed extension API.

We'll want to keep this list updated as we note things that we want to
change in the next version of the extension API. This will help with
batching breaking changes together so that we're not constantly creating
new versions of the extension API for one-off changes.

Release Notes:

- N/A
2024-08-15 13:10:46 -04:00
Bennet Bo Fenner
0b3e5b2649
assistant: Support retrying empty workflow step (#16301)
Co-Authored-by: Nathan <nathan@zed.dev>
Co-Authored-by: Kirill <kirill@zed.dev>

Release Notes:

- N/A

Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Kirill <kirill@zed.dev>
2024-08-15 19:05:30 +02:00
Kirill Bulatov
c45adce2e3
Run slash commands both on enter and on argument completion that requires it (#16283)
Release Notes:

- N/A
2024-08-15 19:36:30 +03:00
Marshall Bowers
03b843ebf3
live_kit_client: Suppress clippy::arc_with_non_send_sync (#16298)
This PR suppresses the
[`clippy::arc_with_non_send_sync`](https://rust-lang.github.io/rust-clippy/master/index.html#/arc_with_non_send_sync),
as there were some warnings that would—only sometimes—show up when
running Clippy.

Release Notes:

- N/A
2024-08-15 11:46:43 -04:00
David Soria Parra
02ea6ac845
context_servers: Add initial implementation (#16103)
This commit proposes the addition of "context serveres" and the
underlying protocol (model context protocol). Context servers allow
simple definition of slash commands in another language and running
local on the user machines. This aims to quickly prototype new commands,
and provide a way to add personal (or company wide) customizations to
the assistant panel, without having to maintain an extension. We can
use this to reuse our existing codebase, with authenticators, etc and
easily have it provide context into the assistant panel.

As such it occupies a different design space as extensions, which I
think are
more aimed towards long-term, well maintained pieces of code that can be
easily distributed.

It's implemented as a central crate for easy reusability across the
codebase
and to easily hook into the assistant panel at all points.

Design wise there are a few pieces:
1. client.rs: A simple JSON-RPC client talking over stdio to a spawned
server. This is
very close to how LSP work and likely there could be a combined client
down the line.
2. types.rs: Serialization and deserialization client for the underlying
model context protocol.
3. protocol.rs: Handling the session between client and server.
4. manager.rs: Manages settings and adding and deleting servers from a
central pool.

A server can be defined in the settings.json as:

```
"context_servers": [
   {"id": "test", "executable": "python", "args": ["-m", "context_server"]
]
```

## Quick Example
A quick example of how a theoretical backend site can look like. With
roughly 100 lines
of code (nicely generated by Claude) and a bit of decorator magic (200
lines in total), one
can come up with a framework that makes it as easy as:

```python
@context_server.slash_command(name="rot13", description="Perform a rot13 transformation")
@context_server.argument(name="input", type=str, help="String to rot13")
async def rot13(input: str) -> str:
    return ''.join(chr((ord(c) - 97 + 13) % 26 + 97) if c.isalpha() else c for c in echo.lower())
```

to define a new slash_command.

## Todo:
 - Allow context servers to be defined in workspace settings.
 - Allow passing env variables to context_servers


Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-08-15 10:49:30 -04:00
Max Brunsfeld
e0cabbd142
Make WorkflowStepResolution an entity (#16268)
This PR is just a refactor, to pave the way toward adding a view for
workflow step resolution. The entity carries the state of the tool
call's streaming output.

Release Notes:

- N/A
2024-08-14 22:44:44 -07:00
Danilo Leal
102796979b
assistant: Fine-tune workflow step header design (#16272)
- Removes layout shift when buttons appear after transformation resolution
- Refine icons and button colors

Release Notes:

- N/A
2024-08-15 01:28:54 -03:00
Max Brunsfeld
4c390b82fb
Make LanguageModel::use_any_tool return a stream of chunks (#16262)
This PR is a refactor to pave the way for allowing the user to view and
edit workflow step resolutions. I've made tool calls work more like
normal streaming completions for all providers. The `use_any_tool`
method returns a stream of strings (which contain chunks of JSON). I've
also done some minor cleanup of language model providers in general,
removing the duplication around handling streaming responses.

Release Notes:

- N/A
2024-08-14 18:02:46 -07:00
Richard Feldman
796cba9e0e
Improve workflow prompt, accept nonexistent directories from workflows (#16251)
Release Notes:

- Workflows can now create new files in folders that didn't exist

---------

Co-authored-by: jvmncs <7891333+jvmncs@users.noreply.github.com>
2024-08-14 16:18:41 -06:00
Marshall Bowers
18aff55f34
zed_extension_api: Release v0.1.0 (#16254)
This PR releases v0.1.0 of the Zed extension API.

Release Notes:

- N/A
2024-08-14 17:33:17 -04:00
Mikayla Maki
271e774713
Fix a bug where directories were not matching in the fuzzy matcher, when query contains the worktree root name (#16242)
Release Notes:

- N/A

Co-authored-by: Max <max@zed.dev>
2024-08-14 12:43:00 -07:00
Kirill Bulatov
e8bae839ed
Disable forceful sorting of the slash command argument completions (#16240)
Also bubble up the current active tab's path in the \tab argument
completions.

Release Notes:

- N/A
2024-08-14 22:34:25 +03:00
Vitaly Slobodin
b55e8383c8
terminal: Fix Python virtual environment detection (#15989)
A Python virtual environment places a copy of the Python interpreter and
related files into a special directory, such as `.env` or `env`.
Currently, the built-in Zed terminal does not check if any entries
specified in `terminal.detect_venv.directories` are directories. If a
regular file with the same name exists, the terminal incorrectly
attempts to activate it as a virtual environment. The fix is to ensure
that an entry is a directory before attempting to activate the virtual
environment.

Here are screenshots of 3 possible scenarios:

# With a regular file `.env` in the worktree

## Before


![before](https://github.com/user-attachments/assets/6237a048-432c-4530-892e-91db16ac71bb)

## After


![after](https://github.com/user-attachments/assets/8268dbf4-7f22-441c-a46d-5df9c38131f9)


# With a directory called `.env` in the worktree


![with_pyenv](https://github.com/user-attachments/assets/8d901874-758d-4473-b35a-9c3db32d3b38)


Release Notes:

- Fixed detection of Python virtual environments
([#15570](https://github.com/zed-industries/zed/issues/15570)).
2024-08-14 21:33:02 +03:00
Bennet Bo Fenner
ccd8f75cff
assistant: Adjust terms of service notice (#16235)
Co-Authored-by: Max <max@zed.dev>
Co-Authored-by: Marshall <marshall@zed.dev>
Co-Authored-by: Peter <peter@zed.dev>

<img width="396" alt="image"
src="https://github.com/user-attachments/assets/62282506-c74a-455e-ae4d-0438d47fed96">

Release Notes:

- N/A

Co-authored-by: Max <max@zed.dev>
Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Peter <peter@zed.dev>
2024-08-14 19:21:07 +02:00
Joseph T Lyons
04ee5e3e6e v0.150.x dev 2024-08-14 12:46:00 -04:00
Marshall Bowers
8ad7d69378
indexed_docs: Normalize - in crate names to _ when computing rustdoc output path (#16234)
This PR fixes an issue where crate names that included `-`s would not
work properly when indexing them with rustdoc, due to the output
directories using `_` instead of `-`.

Release Notes:

- N/A
2024-08-14 12:37:02 -04:00
Kirill Bulatov
8df21f7bcd
Fix slash command argument completion bugs (#16233)
Release Notes:

- N/A

---------

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-08-14 19:36:55 +03:00
Bennet Bo Fenner
793a90c3e1
assistant: Improve terminal slash command (#16229)
- Fix terminal slash command not working when terminal tab was placed in
center workspace
- Removed `--line-count` argument, you can now just pass a number to the
slash command
e.g. `/terminal 10` will show the last 10 lines of the active terminal
- Increase default context lines to 50
- We will revisit this once we add support for only including the last n
amount of commands that were run

Release Notes:

- N/A
2024-08-14 18:04:36 +02:00
Bennet Bo Fenner
caf222a71d
assistant: Show errors without mouse interaction (#16226)
https://github.com/user-attachments/assets/a8e5e0ce-349d-4836-afe6-fc960a307c9f


Release Notes:

- N/A

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
Co-authored-by: Danilo <danilo@zed.dev>
2024-08-14 17:18:39 +02:00
Kirill Bulatov
8d9dcf1e78
Stop automatically running /file command afer file suggestions (#16222)
https://github.com/user-attachments/assets/c5723950-7628-4073-bf03-f0a7473e984e

Release Notes:

- N/A
2024-08-14 17:47:03 +03:00
Stanislav Alekseev
aa31f9ded0
Fix diagnostic popups not having a max width (#16092)
They were probably broken by #14518 

Release Notes:

- N/A
2024-08-14 16:37:35 +02:00
Marshall Bowers
f8a72b5d0a
assistant: Run /docs when completing a suggested (unindexed) package (#16218)
This PR is a follow-up to
https://github.com/zed-industries/zed/pull/16216, as we want to run the
`/docs` command when completing a suggested package that has yet to be
indexed.

Release Notes:

- N/A
2024-08-14 10:29:03 -04:00
Kirill Bulatov
8fe2de1737
Further improve /tabs command and slash arguments completion (#16216)
* renames `/tabs` to `/tab`
* allows to insert multiple tabs when fuzzy matching by the names
* improve slash command completion API, introduce a notion of multiple
arguments
* properly fire off commands on arguments' completions with
`run_command: true`

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <marshall@zed.dev>
2024-08-14 17:11:51 +03:00
张小白
88a12b60a9
windows: Fix supermaven (#16203)
Closes #16194

This PR introduces the following changes:

1. Updated the download process to retrieve the `.exe` file, as the API
response indicates that the `.exe` file should be downloaded on Windows.
> API response:
"https://supermaven-public.s3.amazonaws.com/sm-agent/26/windows/amd64/sm-agent.exe"
2. Modified the startup behavior of supermaven to prevent the cmd window
from appearing.

Release Notes:

- N/A
2024-08-14 17:01:16 +03:00
Thorsten Ball
0eb96c72e3
context inspector: Log when no suggestions (#16208)
Release Notes:

- N/A
2024-08-14 14:58:32 +02:00
Danilo Leal
55563831c5
assistant: Adjust slash command popover padding (#16181)
I've looked for other instances of the popover component where this change could cause a spacing regression but couldn't find any yet. Let me know if you do! Intuitively, I wouldn't change this padding directly on the component container, but I didn't find any other way to tackle it.

Release Notes:

- N/A
2024-08-14 09:48:48 -03:00
Piotr Osiewicz
e28681c27e
outline: Match on full item path in Outline::find_most_similar (#16206)
Previously, we were only looking at a simple syntax node name at a time
and not the full path to an item. E.g. in a rust-toolchain.toml file:
```rs
[toolchain]
targets = [ "x86_64-apple-darwin", "aarch64-apple-darwin", "x86_64-unknown-linux-gnu", "wasm32-wasi" ]
```
When matching against a query "toolchain targets" from the Assistant,
we'd try to match it against "toolchain" and "targets" and not against
"toolchain targets" - we only look at the name of the innermost node and
not it's full path.
I'd expect it to significantly improve precision of outline item
matching.

Release Notes:

- N/A

Co-authored-by: Bennet Bo <bennet@zed.dev>
2024-08-14 14:03:28 +02:00