Skip to content

Commit 114b123

Browse files
committed
fix(completion): expand_tilde when path contains glob chars
1 parent 13d5a15 commit 114b123

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

crates/nu-cli/src/completions/completion_common.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ pub fn complete_item(
284284
pub fn escape_path(path: String, dir: bool) -> String {
285285
// make glob pattern have the highest priority.
286286
if nu_glob::is_glob(path.as_str()) {
287+
let pathbuf = nu_path::expand_tilde(path.clone());
288+
let path = pathbuf.to_string_lossy();
287289
return if path.contains('\'') {
288290
// decide to use double quote, also need to escape `"` in path
289291
// or else users can't do anything with completed path either.

0 commit comments

Comments
 (0)