mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-06 02:37:21 +00:00
a515442a36
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>
52 lines
1.7 KiB
Handlebars
52 lines
1.7 KiB
Handlebars
Here's a text file that I'm going to ask you to make an edit to.
|
|
|
|
{{#if language_name}}
|
|
The file is in {{language_name}}.
|
|
{{/if}}
|
|
|
|
You need to rewrite a portion of it.
|
|
|
|
The section you'll need to edit is marked with <rewrite_this></rewrite_this> tags.
|
|
|
|
<document>
|
|
{{{document_content}}}
|
|
</document>
|
|
|
|
{{#if is_truncated}}
|
|
The context around the relevant section has been truncated (possibly in the middle of a line) for brevity.
|
|
{{/if}}
|
|
|
|
Rewrite the section of {{content_type}} in <rewrite_this></rewrite_this> tags based on the following prompt:
|
|
|
|
<prompt>
|
|
{{{user_prompt}}}
|
|
</prompt>
|
|
|
|
Here's the section to edit based on that prompt again for reference:
|
|
|
|
<rewrite_this>
|
|
{{{rewrite_section}}}
|
|
</rewrite_this>
|
|
|
|
You'll rewrite this entire section, but you will only make changes within certain subsections.
|
|
|
|
{{#if has_insertion}}
|
|
Insert text anywhere you see it marked with with <insert_here></insert_here> tags. Do not include <insert_here> tags in your output.
|
|
{{/if}}
|
|
{{#if has_replacement}}
|
|
Edit edit text that you see surrounded with <edit_here></edit_here> tags. Do not include <edit_here> tags in your output.
|
|
{{/if}}
|
|
|
|
<rewrite_this>
|
|
{{{rewrite_section_with_selections}}}
|
|
</rewrite_this>
|
|
|
|
Only make changes that are necessary to fulfill the prompt, leave everything else as-is. All surrounding {{content_type}} will be preserved. Do not output the <rewrite_this></rewrite this> tags or anything outside of them.
|
|
|
|
Start at the indentation level in the original file in the rewritten {{content_type}}. Don't stop until you've rewritten the entire section, even if you have no more changes to make. Always write out the whole section with no unnecessary elisions.
|
|
|
|
Immediately start with the following format with no remarks:
|
|
|
|
```
|
|
\{{REWRITTEN_CODE}}
|
|
```
|