Fix "set fish_complete_path" accidentally disabling autoloading

Commit 5918bca1eb (Make "complete -e" prevent completion autoloading,
2024-08-24) makes "complete -e foo" add a tombstone for "foo", meaning we
will never again load completions for "foo".

Due to an oversight, the same tombstone is added when we clear cached
completions after changing "fish_complete_path", preventing completions from
being loaded in that case.  Fix this by restoring the old behavior unless
the user actually used "complete -e".
This commit is contained in:
Johannes Altmanninger
2025-05-29 14:20:11 +02:00
parent 52f23b9752
commit a7c04890c9
3 changed files with 19 additions and 7 deletions

View File

@@ -1,9 +1,21 @@
#RUN: %fish %s
set -g fish_complete_path c1 c2
mkdir c1 c2
function foo; end
mkdir $__fish_config_dir/completions
echo >$__fish_config_dir/completions/foo.fish "echo auto-loading foo.fish"
for i in c1 c2
echo >$i/foo.fish "echo auto-loading $i/foo.fish"
end
complete -C "foo " >/dev/null
# CHECK: auto-loading foo.fish
# CHECK: auto-loading c1/foo.fish
complete -C "foo " >/dev/null
# already loaded
set -g fish_complete_path c2
complete -C "foo " >/dev/null
# CHECK: auto-loading c2/foo.fish
set -g fish_complete_path c1 c2
complete -C "foo " >/dev/null
# CHECK: auto-loading c1/foo.fish