From 88000eb7e239be6c8ad33988ee52738e64185a9e Mon Sep 17 00:00:00 2001 From: Tristan Hume Date: Tue, 25 Jun 2024 04:11:21 -0400 Subject: [PATCH] Fix bug with inline assist and indentation on empty lines (#13489) Fix a minor bug when the inline assistant model spits out an empty line with leading indentation on it. This happens sometimes with Claude 3.5 Sonnet and currently it causes the following line to have the wrong indentation. Release Notes: - N/A --- crates/assistant/src/inline_assistant.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/assistant/src/inline_assistant.rs b/crates/assistant/src/inline_assistant.rs index e655b66e6c4158da080d3e9cd12fcce7d640bb58..76131384a9882f408f64ec4e95975e4f3c2f5ec0 100644 --- a/crates/assistant/src/inline_assistant.rs +++ b/crates/assistant/src/inline_assistant.rs @@ -1893,6 +1893,11 @@ impl Codegen { if lines.peek().is_some() { hunks_tx.send(diff.push_new("\n")).await?; + if line_indent.is_none() { + // Don't write out the leading indentation in empty lines on the next line + // This is the case where the above if statement didn't clear the buffer + new_text.clear(); + } line_indent = None; first_line = false; }