Open ericbn opened 2 years ago
The ZLE widgets dumped by compinit (before sourcing zsh-syntax-highlighting) are not dumped in a subsequent compdump (after sourcing zsh-syntax-highlighting) because they have been wrapped by zsh-syntax-highlighting.
First things first, could you please confirm that you have a valid use-case for running compdump? Asking because of this bit of zsh's documentation: https://github.com/zsh-users/zsh/blob/2876c25a28b8052d6683027998cc118fc9b50157/Doc/Zsh/compsys.yo#L176-L179
There's also https://github.com/zsh-users/zsh/blob/2876c25a28b8052d6683027998cc118fc9b50157/Doc/Zsh/contrib.yo#L252-L259.
Maybe a solution is to prepend a
_
to the ZLE widget wrapper name when the original name also starts with_
?
We're migrating away from wrapping widgets. Could you try the redrawhook codepath (by inserting a true
before is-at-least 5.8.0.2
in zsh-syntax-highlighting.zsh)? It'll be the default under zsh 5.9 once that is released.
Thanks for the thorough investigation!
Hi @danielshahaf. What I'm trying to do with compdump
is dump the completion configuration only after I update the git repositories of the external plugins I use. I'm trying this instead of using compinit
without -C
during startup, since this has its limitations: compinit
will only detect that the completion configuration changed if the number of functions changed or the Zsh version changed. Is there a safe way to do it, and faster than just recreating the dumpfile every time?
And yes, using the redrawhook codepath solves the issue and makes compdump
output the exact same configuration as compinit -C
did before zsh-syntax-highlighting was sourced. Cool!
Is there a safe way to do it, and faster than just recreating the dumpfile every time?
I'm not sure. You might ask zsh-users@.
And yes, using the redrawhook codepath solves the issue and makes
compdump
output the exact same configuration ascompinit -C
did before zsh-syntax-highlighting was sourced. Cool!
Thanks for confirming. I guess we'll just close this issue when zsh 5.9 is released, unless there's a particular reason to fix it for older versions as well.
Describe the bug The ZLE widgets dumped by compinit (before sourcing zsh-syntax-highlighting) are not dumped in a subsequent compdump (after sourcing zsh-syntax-highlighting) because they have been wrapped by zsh-syntax-highlighting.
How to reproduce
Current output
Expected output There should be no output from diff.
Additional context Without sourcing zsh-syntax-highlighting, I get:
After sourcing zsh-syntax-highlighting, I get:
And compdump will dump all widgets from
zle -lL
that march_*
in the 3rd and 5th words in the list above.Maybe a solution is to prepend a
_
to the ZLE widget wrapper name when the original name also starts with_
?EDIT: Or letting compdump use the wrapper names will actually not work at all! In this case, the solution could be to not wrap widgets with names and respective function names both starting with
_
...