Commit graph

8 commits

Author SHA1 Message Date
Roy Williams
28a54ce122
Add diagnostic information to context of inline assistant (#18096)
Release Notes:

- Added Diagnostic information to inline assistant. This enables users
to just say "Fix this" and have the model know what the errors are.
2024-09-19 14:16:01 -06:00
Nathan Sobo
07d5e22cbe
Revert changes to inline assist indentation logic and prompt (#16403)
Some checks are pending
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Create a Linux bundle (push) Blocked by required conditions
CI / Create arm64 Linux bundle (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
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.
2024-08-17 02:24:55 -06:00
jvmncs
a3a6ebcf31
Small fixes to content generation prompt (#16359)
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
2024-08-16 12:31:38 -04: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
jvmncs
6713e40875
Revert "Simplify inline assist to avoid spurious xml in completions (… (#16231)
…#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
2024-08-14 12:20:22 -04:00
jvmncs
c3edbd7d9a
Simplify inline assist to avoid spurious xml in completions (#16184)
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
2024-08-13 17:05:50 -04:00
Nathan Sobo
a515442a36
Rely on model to determine indentation level and always rewrite the full line (#16145)
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>
2024-08-12 22:41:24 -06:00
Nathan Sobo
c8f1358629
Allow prompt templates to be overridden in the zed configuration directory (#15887)
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.
2024-08-06 19:30:48 -06:00