Adds actions so you can have customized keybindings for `insert` and
`replace` modes.
And add `shift-enter` as a default for `replace`, this will override the
default setting
`completions.lsp_insert_mode` which is set to `replace_suffix`, which
tries to "smartly"
decide whether to replace or insert based on the surrounding text.
For those who come from VSCode, if you want to mimic their behavior, you
only have to
set `completions.lsp_insert_mode` to `insert`.
If you want `tab` and `enter` to do different things, you need to remap
them, here is
an example:
```jsonc
[
// ...
{
"context": "Editor && showing_completions",
"bindings": {
"enter": "editor::ConfirmCompletionInsert",
"tab": "editor::ConfirmCompletionReplace"
}
},
]
```
Closes#24577
- [x] Make LSP completion insertion mode decision in guest's machine
(host is currently deciding it and not allowing guests to have their own
setting for it)
- [x] Add shift-enter as a hotkey for `replace` by default.
- [x] Test actions.
- [x] Respect the setting being specified per language, instead of using
the "defaults".
- [x] Move `insert_range` of `Completion` to the Lsp variant of
`.source`.
- [x] Fix broken default, forgotten after
https://github.com/zed-industries/zed/pull/27453#pullrequestreview-2736906628,
should be `replace_suffix` and not `insert`.
Release Notes:
- LSP completions: added actions `ConfirmCompletionInsert` and
`ConfirmCompletionReplace` that control how completions are inserted,
these override `completions.lsp_insert_mode`, by default, `shift-enter`
triggers `ConfirmCompletionReplace` which replaces the whole word.
The bash tool will now truncate its output to 8192 bytes (or the last
newline before that).
We also added a global limit for any tool that produces a clearly large
output that wouldn't fit the context window.
Release Notes:
- agent: Truncate bash tool output
---------
Co-authored-by: Michael Sloan <mgsloan@gmail.com>
Release Notes:
- agent: The history view is now more easily accessible via the icon
button in the Agent Panel toolbar.
---------
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
This PR simplifies the button to send a new message as well as the
"generation" display design.
Release Notes:
- N/A
---------
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
This PR removes the retained `MarkdownStyle` on the `Markdown` entity in
favor of using the `MarkdownElement` directly and passing the
`MarkdownStyle` to it.
This makes it so switching themes will be reflected live in the code
block styles.
Release Notes:
- N/A
---------
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Agus Zubiaga <hi@aguz.me>
I wanted this for CONL (https://conl.dev )'s nascent langauge server,
and it seems like most of the support was already wired up on the LSP
side, so this surfaces it into the editor.
Release Notes:
- Added support for the `insert_text_mode` field of completions from the
language server protocol.
I found a few more cases where the UI wasn't updated immediately after
an interaction.
Release Notes:
- agent: Fixed delay after removing threads from "Past Interactions"
- agent: Fixed delay after adding/remove context via keyboard
This PR fixes the `assistant: open prompt library` action in the command
palette not opening the prompt library when the Assistant Panel did not
have focus.
Fixes https://github.com/zed-industries/zed/issues/28058.
Release Notes:
- assistant: Fixed `assistant: open prompt library` not opening the
prompt library when the Assistant Panel was not focused.
This PR fixes an issue where opening the configuration view from the
model selector in the Agent (or inline assist) was not working properly.
Fixes https://github.com/zed-industries/zed/issues/28078.
Release Notes:
- Agent Beta: Fixed an issue where selecting "Configure" in the model
selector would not bring up the configuration view.
This would cause the history view not to get refreshed immediately when
a thread was deleted
Release Notes:
- agent: Fixed a bug where the history view wouldn't refresh after
deleting a thread
#28102 introduced a bug where thread summaries wouldn't get generated
because they would get set to the default title instead of `None`.
Not adding a release note because the bug didn't make it to Preview.
Release Notes:
- N/A
A "Near" block acts similarly to a "Below" block, but can (if it's
height is <= one line height) be shown on the end of the preceding line
instead of adding an entire blank line to the editor.
You can test it out by pasting this into `go_to_diagnostic_impl` and
then press `F8`
```
let buffer = self.buffer.read(cx).snapshot(cx);
let selection = self.selections.newest_anchor();
self.display_map.update(cx, |display_map, cx| {
display_map.insert_blocks(
[BlockProperties {
placement: BlockPlacement::Near(selection.start),
height: Some(1),
style: BlockStyle::Flex,
render: Arc::new(|_| {
div()
.w(px(100.))
.h(px(16.))
.bg(gpui::hsla(0., 0., 1., 0.5))
.into_any_element()
}),
priority: 0,
}],
cx,
)
});
return;
```
Release Notes:
- N/A
---------
Co-authored-by: Antonio Scandurra <me@as-cii.com>
This PR renames the `AssistantEvent` type to `AssistantEventData`, as it
no longer represents the event itself, just the data needed to construct
it.
Pulling out of https://github.com/zed-industries/zed/pull/25179.
Release Notes:
- N/A
This PR fixes a panic that could occur when opening the Agent diff from
the workspace (with the agent panel closed).
Release Notes:
- agent: Fixed a panic when running the `agent: open agent diff` command
with the Agent Panel closed.
Release Notes:
- agent: Tool call's input and output content are now rendered with
Markdown, which allows them to be selected and copied.
---------
Co-authored-by: Agus Zubiaga <hi@aguz.me>
Release Notes:
- agent: The scrollbar now automatically hides if there's no mouse
movement on the thread list.
---------
Co-authored-by: Agus Zubiaga <agus@zed.dev>
Co-authored-by: Agus Zubiaga <hi@aguz.me>
Closes: https://github.com/zed-industries/zed/issues/20582
Allows users to select a specific model for each AI-powered feature:
- Agent panel
- Inline assistant
- Thread summarization
- Commit message generation
If unspecified for a given feature, it will use the `default_model`
setting.
Release Notes:
- Added support for configuring a specific model for each AI-powered
feature
---------
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
This makes context essentially work the same way as `read-file`,
increasing the likelihood of cache hits.
Just like with `read-file`, we'll notify the model when the user makes
an edit to one of the tracked files. In the future, we want to send a
diff instead of just a list of files, but that's an orthogonal change.
Release Notes:
- agent: Improved caching of files in context
---------
Co-authored-by: Antonio Scandurra <me@as-cii.com>
This PR adds the token count to the active thread view. It doesn't
behaves quite like Assistant 1 where it updates as you type, though; it
updates after you submit the message.
<img
src="https://github.com/user-attachments/assets/82d2a180-554a-43ee-b776-3743359b609b"
width="700" />
---
Release Notes:
- agent: Add token count in the thread view
---------
Co-authored-by: Agus Zubiaga <hi@aguz.me>
### Context
The Anthropic API fails if a request message contains a tool use and no
`Text` segments or it only contains empty `Text` segments. These are
cases that the model itself produces, but the API doesn't support
sending them back.
#27917 fixed this by appending "Using tool..." in the thread's message,
but this causes the actual conversation to include it, so it would
appear in the UI (we would actually display a gap because we never
rendered its markdown, but "Using tool..." would show up when the thread
was restored).
### Solution
We'll now only append this placeholder when we build the request, so the
API still sees it, but the UI/Thread doesn't.
Another issue we found is that the model starts mimicking these
placeholders in later tool uses which is undesirable. So unfortunately,
we had to add logic to filter them out.
Release Notes:
- agent: Improved rendering of tool uses without text
---------
Co-authored-by: Bennet <bennet@zed.dev>
Previously the "Thinking..." step would show up as pending, even though
the user cancelled the generation:
<img width="672" alt="image"
src="https://github.com/user-attachments/assets/c9cdce0a-d827-4e23-96f5-b150465911a7"
/>
Release Notes:
- Fixed an issue where the thinking step would show up as pending even
when the generation was cancelled
This happened because of two reasons:
- `Workspace::recent_navigation_history` didn't include the current file
- The context picker added the current file to a exclude list
The latter was actually intentional because we already show the file in
the suggested context, but now that we actually have mentions, it's just
inconvenient not to have it there.
Release Notes:
- N/A
This PR adds the ability to edit previous user messages in the thread.
Release Notes:
- Agent: Added the ability to edit previous user messages
(Preview-only).