diff --git a/crates/nu-cli/src/completions/file_completions.rs b/crates/nu-cli/src/completions/file_completions.rs index d589799d1b..6ee3cf55b2 100644 --- a/crates/nu-cli/src/completions/file_completions.rs +++ b/crates/nu-cli/src/completions/file_completions.rs @@ -146,6 +146,8 @@ pub fn file_path_completion( || path.contains('"') || path.contains(' ') || path.contains('#') + || path.contains('(') + || path.contains(')') { path = format!("`{}`", path); } diff --git a/crates/nu-cli/tests/completions.rs b/crates/nu-cli/tests/completions.rs index fb293b69b3..240b794f67 100644 --- a/crates/nu-cli/tests/completions.rs +++ b/crates/nu-cli/tests/completions.rs @@ -444,6 +444,7 @@ fn file_completion_quoted() { "`te st.txt`".to_string(), "`te#st.txt`".to_string(), "`te'st.txt`".to_string(), + "`te(st).txt`".to_string(), ]; match_suggestions(expected_paths, suggestions) diff --git a/tests/fixtures/quoted_completions/te(st).txt b/tests/fixtures/quoted_completions/te(st).txt new file mode 100644 index 0000000000..e69de29bb2