From 71aeb6a636340db4217295e2fa5c0b4768ed7deb Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Thu, 7 Nov 2024 15:34:19 +0100 Subject: [PATCH] editor: Do not show inline completion if snippet is active (#20300) This avoids inline completions being shown (and overriding `` behavior) when a snippet is active and the user wants to go through snippet placeholders with ``. Easy to reproduce: Open a Rust file and use the `tfn` snippet to produce a test function. Delete the placeholder. Without the change here, the inline provider would suggest a function name. If you ``, you accept it, but then you can't `` into the function body. With this change the inline completions are deactivated as long as a snippet is active. Closes #19484 Release Notes: - Fixed inline completions (Copilot, Supermaven, ...) taking over when a snippet completion was active. That resulted in `tab` not working to jump to the next placeholder in the snippet. --- crates/editor/src/editor.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index adc4c96f986a0355fd1e6abfe52b0ae1acb783ee..2323cf8751b1a12cd22878b50238273d9c1ca326 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -2498,6 +2498,10 @@ impl Editor { buffer_position: language::Anchor, cx: &AppContext, ) -> bool { + if !self.snippet_stack.is_empty() { + return false; + } + if let Some(provider) = self.inline_completion_provider() { if let Some(show_inline_completions) = self.show_inline_completions_override { show_inline_completions