From 5e177fe8e736bff679b6baf04a81a06d3cbd8a6d Mon Sep 17 00:00:00 2001 From: Herlon Aguiar Date: Thu, 7 Apr 2022 21:31:56 +0200 Subject: [PATCH] nu-cli/completions: fix file completions filtering (#5122) --- crates/nu-cli/src/completions/file_completions.rs | 5 +++++ crates/nu-json/src/de.rs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/nu-cli/src/completions/file_completions.rs b/crates/nu-cli/src/completions/file_completions.rs index 2c9ff2fbf4..0f20dd66ee 100644 --- a/crates/nu-cli/src/completions/file_completions.rs +++ b/crates/nu-cli/src/completions/file_completions.rs @@ -97,6 +97,11 @@ impl Completer for FileCompletion { non_hidden } + + // Replace base filter with no filter once all the results are already based in the current path + fn filter(&self, _: Vec, items: Vec, _: CompletionOptions) -> Vec { + items + } } pub fn file_path_completion( diff --git a/crates/nu-json/src/de.rs b/crates/nu-json/src/de.rs index 430aa68b01..a462a408fb 100644 --- a/crates/nu-json/src/de.rs +++ b/crates/nu-json/src/de.rs @@ -70,7 +70,7 @@ where } } - fn is_punctuator_char(&mut self, ch: u8) -> bool { + fn is_punctuator_char(&self, ch: u8) -> bool { matches!(ch, b'{' | b'}' | b'[' | b']' | b',' | b':') }