Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(async)!: implement async prompt API and apply to git prompt #12257

Merged
merged 3 commits into from Mar 7, 2024

Conversation

mcornella
Copy link
Member

Standards checklist:

  • The PR title is descriptive.
  • The PR doesn't replicate another PR which is already open.
  • I have read the contribution guide and followed all the instructions.
  • The code follows the code style guide detailed in the wiki.
  • The code is mine or it's from somewhere with an MIT-compatible license.
  • The code is efficient, to the best of my ability, and does not waste computer resources.
  • The code is stable and I have tested it myself, to the best of my abilities.
  • If the code introduces new aliases, I provide a valid use case for all plugin users down below.

Changes:

  • Implement generic async prompt feature
  • Apply to git prompt by default

Other comments:

BREAKING CHANGE: the git_prompt_info prompt function has been reworked by default to use the new async prompt feature. If you're experiencing issues, you can set the following zstyle setting in your .zshrc file before Oh My Zsh is sourced:

zstyle ':omz:alpha:lib:git' async-prompt no

Fixes #10869

@ohmyzsh ohmyzsh bot added the Area: core Issue or PR related to core parts of the project label Mar 4, 2024
BREAKING CHANGE: the `git_prompt_info` prompt function has been
reworked by default to use the new async prompt feature. If you're
experiencing issues see ohmyzsh#12257.
Copy link
Member

@carlosala carlosala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized that if you don't have a git_prompt_info-theme you'll still be executing the git status thing everytime.
IMO the best way to overtake this issue is by moving the _omz_async_functions into its own function that enables the precmd as soon as there's any function appended to it, and the git_prompt_info could call there the first time that is executed.
What do you think?

lib/git.zsh Outdated Show resolved Hide resolved
Copy link
Member

@carlosala carlosala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!🚀

Copy link
Member Author

@mcornella mcornella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last changes required

lib/async_prompt.zsh Outdated Show resolved Hide resolved
lib/async_prompt.zsh Outdated Show resolved Hide resolved
@carlosala carlosala merged commit 083cc2c into ohmyzsh:master Mar 7, 2024
2 checks passed
@mcornella mcornella deleted the feat/async-prompt branch March 9, 2024 17:25
lesterchan added a commit to lesterchan/oh-my-zsh that referenced this pull request Mar 16, 2024
* upstream/master: (90 commits)
  feat(gradle): update completion to version 25da917c (ohmyzsh#12287)
  fix(dependencies): copy gradle LICENSE
  feat(dependencies): enable gradle plugin
  docs: fix typos (ohmyzsh#12284)
  docs(pyenv): fix typo (ohmyzsh#12283)
  feat(extract): prefer using `pbzip2` instead of `bunzip2` (ohmyzsh#12280)
  docs(readme): add contributor list (ohmyzsh#12236)
  feat(fzf): add default fzf_base for msys2 (ohmyzsh#12274)
  fix(async): register the git prompt async handler correctly (ohmyzsh#12267)
  fix(git): disable temporarely async prompt
  feat(async)!: implement async prompt API and apply to git prompt (ohmyzsh#12257)
  feat(tools): update `supports_hyperlinks` (ohmyzsh#12258)
  chore(gitfast): remove update script (ohmyzsh#12262)
  perf(nvm): don't call `nvm version` on every cd
  feat(nvm)!: make `lazy` and `autoload` options compatible
  fix(nvm): remove zsh completion
  fix(terraform): fix completion repeating flags with value (ohmyzsh#12256)
  fix(terraform): pass `-chdir` to completion commands (ohmyzsh#12254)
  feat(python): add auto venv activation (ohmyzsh#12248)
  feat(terraform): update completion to `v1.7` (ohmyzsh#12252)
  ...
gerardo pushed a commit to gerardo/oh-my-zsh that referenced this pull request Mar 19, 2024
* upstream/master: (212 commits)
  fix(docker-compose): completion regression (ohmyzsh#12288)
  feat(gradle): update completion to version 25da917c (ohmyzsh#12287)
  fix(dependencies): copy gradle LICENSE
  feat(dependencies): enable gradle plugin
  docs: fix typos (ohmyzsh#12284)
  docs(pyenv): fix typo (ohmyzsh#12283)
  feat(extract): prefer using `pbzip2` instead of `bunzip2` (ohmyzsh#12280)
  docs(readme): add contributor list (ohmyzsh#12236)
  feat(fzf): add default fzf_base for msys2 (ohmyzsh#12274)
  fix(async): register the git prompt async handler correctly (ohmyzsh#12267)
  fix(git): disable temporarely async prompt
  feat(async)!: implement async prompt API and apply to git prompt (ohmyzsh#12257)
  feat(tools): update `supports_hyperlinks` (ohmyzsh#12258)
  chore(gitfast): remove update script (ohmyzsh#12262)
  perf(nvm): don't call `nvm version` on every cd
  feat(nvm)!: make `lazy` and `autoload` options compatible
  fix(nvm): remove zsh completion
  fix(terraform): fix completion repeating flags with value (ohmyzsh#12256)
  fix(terraform): pass `-chdir` to completion commands (ohmyzsh#12254)
  feat(python): add auto venv activation (ohmyzsh#12248)
  ...
keenahn added a commit to keenahn/oh-my-zsh that referenced this pull request Mar 22, 2024
* master: (223 commits)
  fix(mise): update environment when loading the plugin (ohmyzsh#12294)
  fix(docker-compose): completion regression (ohmyzsh#12288)
  feat(gradle): update completion to version 25da917c (ohmyzsh#12287)
  fix(dependencies): copy gradle LICENSE
  feat(dependencies): enable gradle plugin
  docs: fix typos (ohmyzsh#12284)
  docs(pyenv): fix typo (ohmyzsh#12283)
  feat(extract): prefer using `pbzip2` instead of `bunzip2` (ohmyzsh#12280)
  docs(readme): add contributor list (ohmyzsh#12236)
  feat(fzf): add default fzf_base for msys2 (ohmyzsh#12274)
  fix(async): register the git prompt async handler correctly (ohmyzsh#12267)
  fix(git): disable temporarely async prompt
  feat(async)!: implement async prompt API and apply to git prompt (ohmyzsh#12257)
  feat(tools): update `supports_hyperlinks` (ohmyzsh#12258)
  chore(gitfast): remove update script (ohmyzsh#12262)
  perf(nvm): don't call `nvm version` on every cd
  feat(nvm)!: make `lazy` and `autoload` options compatible
  fix(nvm): remove zsh completion
  fix(terraform): fix completion repeating flags with value (ohmyzsh#12256)
  fix(terraform): pass `-chdir` to completion commands (ohmyzsh#12254)
  ...
fdelacruz pushed a commit to fdelacruz/ohmyzsh that referenced this pull request Mar 27, 2024
…yzsh#12257)

BREAKING CHANGE: the `git_prompt_info` prompt function has been
reworked by default to use the new async prompt feature. If you're
experiencing issues see ohmyzsh#12257.

Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
pull bot pushed a commit to kis87988/ohmyzsh that referenced this pull request Mar 27, 2024
…yzsh#12257)

BREAKING CHANGE: the `git_prompt_info` prompt function has been
reworked by default to use the new async prompt feature. If you're
experiencing issues see ohmyzsh#12257.

Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
lukaselmer pushed a commit to lukaselmer/ohmyzsh that referenced this pull request Apr 16, 2024
…yzsh#12257)

BREAKING CHANGE: the `git_prompt_info` prompt function has been
reworked by default to use the new async prompt feature. If you're
experiencing issues see ohmyzsh#12257.

Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
cschuyle pushed a commit to cschuyle/ohmyzsh that referenced this pull request Apr 18, 2024
…yzsh#12257)

BREAKING CHANGE: the `git_prompt_info` prompt function has been
reworked by default to use the new async prompt feature. If you're
experiencing issues see ohmyzsh#12257.

Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: core Issue or PR related to core parts of the project
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add async prompt features
2 participants