fix(completion): invalid prefix for external path argument with spaces (#15998)

Fixes the default behavior of #15790 

# Description

As for the mentioned carapace version: `cat ~"/Downloads/Obsidian
Vault/"`, the problem lies in the unexpanded home directory `~`. Either
we encourage users to manually expand that in
`$env.config.completions.external.completer` or open an issue on the
carapace project.

# User-Facing Changes

bug fix

# Tests + Formatting

Adjusted

# After Submitting
This commit is contained in:
zc he
2025-06-21 09:33:01 +08:00
committed by GitHub
parent c3079a14d9
commit 760c9ef2e9
4 changed files with 32 additions and 4 deletions

View File

@@ -466,6 +466,14 @@ impl NuCompleter {
return suggestions;
}
}
// for external path arguments with spaces, please check issue #15790
if suggestions.is_empty() {
let (new_span, prefix) =
strip_placeholder_if_any(working_set, &span, strip);
let ctx = Context::new(working_set, new_span, prefix, offset);
suggestions.extend(self.process_completion(&mut FileCompletion, &ctx));
return suggestions;
}
break;
}
}