Try to set the Project's repo if it does not have one when a new RepositoryProvider is registered.

I tested this using my test `HgRepositoryProvider`. Now when I run the following from the
command line:

    atom <path-to-directory-with-hg-repository>

And then run the following in the console:

    atom.project.getRepositories()

I get an array with an `HgRepository` in it. Previously, I got an empty array because the
`Project`'s paths were set before my `HgRepositoryProvider` was registered.
This commit is contained in:
Michael Bolin
2015-02-12 17:11:06 -08:00
parent f7138e5190
commit 5805bf9675
3 changed files with 43 additions and 2 deletions

View File

@@ -53,7 +53,15 @@ class Project extends Model
atom.packages.serviceHub.consume(
'atom.repository-provider',
'^0.1.0',
(provider) => @repositoryProviders.push(provider))
(provider) =>
@repositoryProviders.push(provider)
# If a path in getPaths() does not have a corresponding Repository, try
# to assign one by running through setPaths() again now that
# @repositoryProviders has been updated.
if null in @repositories
@setPaths(@getPaths())
)
@subscribeToBuffer(buffer) for buffer in @buffers