File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
lua/blink/cmp/sources/cmdline Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -41,8 +41,11 @@ function cmdline:get_completions(context, callback)
41
41
local is_path_completion = vim .tbl_contains (constants .completion_types .path , completion_type )
42
42
local is_buffer_completion = vim .tbl_contains (constants .completion_types .buffer , completion_type )
43
43
local is_filename_modifier_completion = cmdline_utils .contains_filename_modifiers (context .line )
44
+ local is_wildcard_completion = cmdline_utils .contains_wildcard (context .line )
44
45
45
- local should_split_path = (is_path_completion or is_buffer_completion ) and not is_filename_modifier_completion
46
+ local should_split_path = (is_path_completion or is_buffer_completion )
47
+ and not is_filename_modifier_completion
48
+ and not is_wildcard_completion
46
49
local context_line , arguments = cmdline_utils .smart_split (context .line , should_split_path )
47
50
local before_cursor = context_line :sub (1 , context .cursor [2 ])
48
51
local _ , args_before_cursor = cmdline_utils .smart_split (before_cursor , should_split_path )
Original file line number Diff line number Diff line change @@ -36,6 +36,11 @@ function utils.contains_filename_modifiers(line)
36
36
return vim .regex (pat ):match_str (line ) ~= nil
37
37
end
38
38
39
+ -- Detects whether the provided line contains wildcard, see :h wildcard
40
+ --- @param line string
41
+ --- @return boolean
42
+ function utils .contains_wildcard (line ) return line :find (' [%*%?%[%]]' ) ~= nil end
43
+
39
44
--- Split the command line into arguments, handling path escaping and trailing spaces.
40
45
--- For path completions, split by paths and normalize each one if needed.
41
46
--- For other completions, splits by spaces and preserves trailing empty arguments.
You can’t perform that action at this time.
0 commit comments