Created
February 15, 2018 07:40
-
-
Save alexdevero/657b4345ff7e115abd926964d4ddb401 to your computer and use it in GitHub Desktop.
Atom - Unsubscribe from the gitrefresh event for every repo in the current project
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
(-> | |
###* | |
# Unsubscribe from the gitrefresh event for every repo in the current project | |
# A fix for issue: https://github.com/atom/atom/issues/9544 | |
### | |
disableGitRefreshOnFocus = -> | |
atom.project.repositories.forEach (repo) -> | |
if repo and repo.subscriptions and repo.subscriptions.disposables and repo.subscriptions.disposables.size | |
Array.from(repo.subscriptions.disposables).forEach (item) -> | |
content = item.disposalAction + '' | |
if content.indexOf('focus') > 1 | |
item.dispose() | |
return | |
return | |
atom.project.emitter.on 'did-change-paths', disableGitRefreshOnFocus | |
disableGitRefreshOnFocus() | |
atom.commands.add 'atom-text-editor', 'custom:refresh-git-status', -> | |
atom.project.repositories.forEach (repo) -> | |
if repo != null | |
repo.refreshStatus() | |
).call this |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment