-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Clink async prompt #2556
Merged
Merged
Clink async prompt #2556
Conversation
This file contains 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
Status branchonly
Status branchonly dax
`git status` and `git diff` can be slow in large repos. Clink v1.2.10 and higher support using Lua coroutines to do expensive parts of prompt filtering in the background. When the expensive parts complete, the prompt gets refreshed. This means even large repos can have fast prompts PLUS git status all the time! This change should be backward/forward compatible with both older and newer versions of Clink (of course only newer versions will gain the benefit).
3 tasks
daxgames
reviewed
Jun 10, 2021
Setting `prompt_overrideGitStatusOptIn = true` will override the `cmder.status` and `cmder.cmdstatus` git config settings and run the git prompt status commands in the background. But it only takes effect when using Clink v1.2.10, since that's required in order to run prompt update commands in the background.
The Cmder prompt normally includes version control info, which involves running some potentially expensive commands. The cmder-powerline-prompt project (and maybe other projects) replaces the Cmder prompt and runs the same potentially expensive commands -- so expensive commands get run twice! This change makes it possible for the user and/or other scripts to disable the version control part of the built-in Cmder prompt. https://github.com/chrisant996/cmder-powerline-prompt
It was less clear before, and it also accidentally took effect when the `prompt.async` Clink setting was off.
@Stanzilla thanks I was just starting to look at this yesterday. |
I am sorry this took me so long to look at this PR. This is an awesome feature, speeds up the prompt to the point the delay is all but imperceptible! Thank you @chrisant996 for this and all the work you have done on revitalizing |
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.
Description
This PR adds support in Cmder for the new "asynchronous prompt filtering" in Clink v1.2.10 and higher. It should be forward/backward compatible with other versions of Clink.
Now the potentially slow
git status
(etc) commands are run in the background, so there's no waiting for the prompt to show up. When the background commands finish, the prompt gets refreshed. To avoid unnecessary flicker, the most recent results are cached so they can be used while waiting for new background commands to finish (switching repos or branches resets the cached results).The new async prompt filtering is enabled by default in Clink, but prompt filters must opt in to use it (which is what this PR does for Cmder's git prompt). It can be turned off via
clink set prompt.async false
. See Asynchronous Prompt Filtering for more info.Merge Notes
This PR is based on the pending PR #2549. When applied after #2549 is committed, I expect this PR should encounter few-or-no merge conflicts. But if it does encounter merge conflicts, let me know and I can resolve them.
Test Notes
prompt.async
setting true (the default).prompt.async
setting false.Everything looks good to me.