This PR reverts #16145 and subsequent changes.
This reverts commit a515442a36.
We still have issues with our approach to indentation in Python
unfortunately, but this feels like a safer equilibrium than where we
were.
Release Notes:
- Returned to our previous prompt for inline assist transformations,
since recent changes were introducing issues.
Fixed the output format section of the content_prompt.hbs template
getting rendered away by handlebars. Also fixed a leftover hardcoded
"Rust" in the rewrite section snippet. (follow-up to #16333)
Release Notes:
- N/A
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.
Release Notes:
- Workflows can now create new files in folders that didn't exist
---------
Co-authored-by: jvmncs <7891333+jvmncs@users.noreply.github.com>
…#16184)"
This reverts commit c3edbd7d9a, which
caused a regression that leaked chatter into inline assist replacements
and <rewrite_this> tags into insertions.
Release Notes:
- N/A
Some prompt changes to highlight:
- Removes `<rewrite_section>` rendering, preferring to just show
`<rewrite_section_with_selections>`
- Concise, terse instructions throughout
I'd like to have experimented with prefilling the assistant response,
but I don't think OpenAI allows for that and wouldn't want to break
compatibility with gpt-4 et al.
Release Notes:
- N/A
This PR simplifies our approach to indentation in the inline assistant
in hopes of improving our experience for Python. We tell the model to
generate the correct indentation in the prompt, and always start
generating at the start of the line. This may fall down for less capable
models, but I want to get a solid experience on the best models and then
figure the rest out later.
Also: We now prefer `./assets/prompts` as an overrides directory when
stdout is a PTY, so you can do `cargo run` and then iterate prompts for
the current run inside the current working copy.
cc @trishume @dsp-ant
Release Notes:
- Zed now allows the model to control indentation when performing inline
transformation. We're hoping this improves the indentation experience in
Python and other indentation-sensitive languages, but it does require
more from the model.
---------
Co-authored-by: Mikayla <mikayla@zed.dev>
This PR opens workflow step editors as preview tabs and closes them upon
exiting the step if they are still in preview mode and they weren't
already open before entering the step.
Making this work was tricky, because we often edit the buffer as part of
displaying the workflow step suggestions to create empty lines where we
can generate. We undo these edits if the transformation is not applied,
but they were causing the preview to be dismissed.
After trying a few approaches, I decided to give workspace `Item`s a
`preserve_preview` method that defaults to false. When the workspace
sees an edit event for the item, it checks if the item wants to preserve
its preview. For buffers, after editing, you can call `refresh_preview`,
which sets a preview version to the current version of the buffer. Any
edits after this version will cause preview to not be preserved.
One final issue is with async auto-indent. To ensure these async edits
don't dismiss the preview, I automatically refresh the preview version
if preview was preserved prior to performing the auto-indent. The
assumption is that these are edits created by other edits, and if we
didn't want to dismiss the preview with the originating edits, then the
auto-indent edits shouldn't dismiss it either.
Release Notes:
- N/A
---------
Co-authored-by: Jason <jason@zed.dev>
This will help us as we hit issues with the /workflow and step
resolution. We can override the baked-in prompts and make tweaks, then
import our refinements back into the source tree when we're ready.
Release Notes:
- N/A
I need this to refine our prompts on the fly as I work.
Release Notes:
- Templates for prompts driving inline transformation in editors and the
terminal can now be overridden in the `~/.config/zed/prompts/templates`
directory. This is an advanced feature, and prevents you from getting
upstream changes. It's intended for use by Zed developers.
Built-in prompts can still be removed from the default prompt, but they
can't be edited and are automatically updated with new Zed releases.
Release Notes:
- N/A
---------
Co-authored-by: Antonio <antonio@zed.dev>
Note that this shouldn't have any visible user-facing behavior yet. The
feature is incomplete but we wanna merge early to avoid a long-running
branch.
Release Notes:
- N/A
---------
Co-authored-by: Nathan <nathan@zed.dev>