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>
This commit is contained in:
parent
e662bfc74f
commit
a515442a36
6 changed files with 235 additions and 565 deletions
|
@ -187,7 +187,12 @@ fn init_common(app_state: Arc<AppState>, cx: &mut AppContext) -> Arc<PromptBuild
|
|||
);
|
||||
snippet_provider::init(cx);
|
||||
inline_completion_registry::init(app_state.client.telemetry().clone(), cx);
|
||||
let prompt_builder = assistant::init(app_state.fs.clone(), app_state.client.clone(), cx);
|
||||
let prompt_builder = assistant::init(
|
||||
app_state.fs.clone(),
|
||||
app_state.client.clone(),
|
||||
stdout_is_a_pty(),
|
||||
cx,
|
||||
);
|
||||
repl::init(
|
||||
app_state.fs.clone(),
|
||||
app_state.client.telemetry().clone(),
|
||||
|
|
|
@ -1018,6 +1018,8 @@ fn open_settings_file(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::stdout_is_a_pty;
|
||||
|
||||
use super::*;
|
||||
use anyhow::anyhow;
|
||||
use assets::Assets;
|
||||
|
@ -3485,8 +3487,12 @@ mod tests {
|
|||
app_state.fs.clone(),
|
||||
cx,
|
||||
);
|
||||
let prompt_builder =
|
||||
assistant::init(app_state.fs.clone(), app_state.client.clone(), cx);
|
||||
let prompt_builder = assistant::init(
|
||||
app_state.fs.clone(),
|
||||
app_state.client.clone(),
|
||||
stdout_is_a_pty(),
|
||||
cx,
|
||||
);
|
||||
repl::init(
|
||||
app_state.fs.clone(),
|
||||
app_state.client.telemetry().clone(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue