Repository navigation
feat(completions): switch to dynamic plugin discovery at tab-press time - #11
Merged
Merged
Conversation
This pull request refactors the shell completion system to discover plugins dynamically at tab-press time instead of requiring shell re-evaluation, and simplifies the installation instructions. The main changes improve user experience by eliminating manual reloading steps and reducing setup complexity. **Dynamic plugin discovery:** * Added a new `__complete` command in `adds-on/src/main.rs` that outputs discovered plugins in completion format, called dynamically by the shell at tab-press time. * Refactored `inject_zsh()` to replace the static plugin list with a dynamic lookup that calls `uv __complete` during tab completion, automatically picking up newly installed plugins without re-evaluation. * Updated Zsh completion injection to merge dynamically discovered plugins into the commands array at runtime while keeping sub-command completions statically injected. * Modified tests to validate the new dynamic lookup mechanism instead of static plugin injection. **Documentation improvements:** * Simplified setup instructions in `README.md` to use a single-line PATH export and one-time completion installation, eliminating the need for `eval` or manual reloading. * Updated completion installation to write directly to completion directories (fpath for zsh, config files for bash/fish) for automatic loading on every new session. * Clarified that new plugins are picked up automatically on every tab-press without additional configuration. * Made the `UV_REAL_PATH` optimization optional and moved it to a separate section.
|
🎉 This PR is included in version 2.2.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors the shell completion system to discover plugins dynamically at tab-press time instead of requiring shell re-evaluation, and simplifies the installation instructions. The main changes improve user experience by eliminating manual reloading steps and reducing setup complexity.
Dynamic plugin discovery:
__completecommand inadds-on/src/main.rsthat outputs discovered plugins in completion format, called dynamically by the shell at tab-press time.inject_zsh()to replace the static plugin list with a dynamic lookup that callsuv __completeduring tab completion, automatically picking up newly installed plugins without re-evaluation.Documentation improvements:
README.mdto use a single-line PATH export and one-time completion installation, eliminating the need forevalor manual reloading.UV_REAL_PATHoptimization optional and moved it to a separate section.