From 848ca1c1ccbf060a3f5778a950f139eb31419413 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Thu, 10 Jan 2019 22:33:31 -0600 Subject: [PATCH] Improve UX by not providing yarn completions if no input Otherwise, the interface would hang while fish processed the output of `all-the-package-names` and then would ultimately not show any results anyhow. --- share/completions/yarn.fish | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/share/completions/yarn.fish b/share/completions/yarn.fish index e2650b7d6..75ccc82ab 100644 --- a/share/completions/yarn.fish +++ b/share/completions/yarn.fish @@ -23,8 +23,11 @@ function __yarn_filtered_list_packages return end - all-the-package-names | string match -er -- "(?:\\b|_)"(commandline -ct | + # Do not provide any completions if nothing has been entered yet + if string match -r . (commandline -ct) + all-the-package-names | string match -er -- "(?:\\b|_)"(commandline -ct | string escape --style=regex) | head -n1000 + end end function __yarn_find_package_json