Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Never show whitespace-only Copilot suggestions (#7623)

Antonio Scandurra93ceb89c0c03
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index c49a5c8c50c..a864204dc84 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -1222,7 +1222,12 @@ impl CopilotState {
if completion_range.is_empty()
&& completion_range.start == cursor.text_anchor.to_offset(&completion_buffer)
{
- Some(&completion.text[prefix_len..completion.text.len() - suffix_len])
+ let completion_text = &completion.text[prefix_len..completion.text.len() - suffix_len];
+ if completion_text.trim().is_empty() {
+ None
+ } else {
+ Some(completion_text)
+ }
} else {
None
}