From 0b2a8d3999bf10c7224d4e79cfbcb5dc131a4849 Mon Sep 17 00:00:00 2001 From: DualFroz Date: Sat, 3 Oct 2026 02:05:03 +0200 Subject: [PATCH] vim: Keep command palette matches next to filename completions With vim or helix mode on, searching the command palette for "split selection" showed only a `:split selection` entry and hid `editor: split selection into lines`. The vim interceptor reads the query as `:split `, and its filename completions were marked exclusive, which drops every regular match. The same happens for other searches that start with a filename command, like "edit prediction". Return the completions as non-exclusive, like every other intercepted command. They are still listed first, so `:sp foo` + enter behaves the same. Closes #64431 --- crates/vim/src/command.rs | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/crates/vim/src/command.rs b/crates/vim/src/command.rs index a80a6fd..89ea94a 100644 --- a/crates/vim/src/command.rs +++ b/crates/vim/src/command.rs @@ -2023,9 +2023,11 @@ pub fn command_interceptor( positions, }); } + // Palette searches like "split selection" or "edit prediction" also + // parse as a command with a filename, so keep the regular matches. CommandInterceptResult { results, - exclusive: true, + exclusive: false, } }) } else { @@ -2634,6 +2636,7 @@ mod test { use crate::{ VimAddon, + command::command_interceptor, state::Mode, test::{NeovimBackedTestContext, VimTestContext}, }; @@ -2984,6 +2987,28 @@ mod test { }); } + #[gpui::test] + async fn test_filename_completions_keep_palette_matches(cx: &mut TestAppContext) { + let mut cx = VimTestContext::new(cx, true).await; + let workspace = cx.workspace(|_, _, cx| cx.weak_entity()); + + let intercept_result = cx + .update(|_, cx| command_interceptor("split selection", workspace, cx)) + .await; + + assert_eq!( + intercept_result + .results + .first() + .map(|item| item.string.as_str()), + Some(":split selection") + ); + assert!( + !intercept_result.exclusive, + "filename completions must not hide the regular command palette matches" + ); + } + #[gpui::test] async fn test_command_write_filename(cx: &mut TestAppContext) { let mut cx = VimTestContext::new(cx, true).await;