Skip to content

Commit 15ac660

Browse files
committed
Fix the usage of the zsh completion through the fpath discovery
Zsh completion files registered through the fpath discovery mecanism have 2 requirements: - the file name must have a `_` prefix - the file must start with a `#compdef` comment describing the registration for that file. The file can then either execute the completion logic directly or call `compdef` to register a function for completion. Keeping the second approach allows to use the same generated script for the global use case than for a sourced configuration script.
1 parent 28c5c2e commit 15ac660

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Command/DumpCompletionCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected function configure()
4848
$shell = $this->guessShell();
4949
[$rcFile, $completionFile] = match ($shell) {
5050
'fish' => ['~/.config/fish/config.fish', "/etc/fish/completions/$commandName.fish"],
51-
'zsh' => ['~/.zshrc', '$fpath[1]/'.$commandName],
51+
'zsh' => ['~/.zshrc', '$fpath[1]/_'.$commandName],
5252
default => ['~/.bashrc', "/etc/bash_completion.d/$commandName"],
5353
};
5454

Resources/completion.zsh

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#compdef {{ COMMAND_NAME }}
2+
13
# This file is part of the Symfony package.
24
#
35
# (c) Fabien Potencier <fabien@symfony.com>

0 commit comments

Comments
 (0)