Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/installed-package-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,17 @@ class InstalledPackageView extends View
@div outlet: 'sections'

initialize: (@pack, @packageManager) ->
@activate()
@populate()
@handleButtonEvents()
@updateFileButtons()
@checkForUpdate()
@subscribeToPackageManager()

activate: ->
# Package.activateConfig() is part of the Private package API and should not be used outside of core.
@pack.activateConfig() if not atom.packages.isPackageActive(@pack.name)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this should be done in a next tick (like it used to be) since activating the config for ~100 packages will probably take some time and at least the settings view will get a chance to render and "feel" like it is continuing to load while the configs are activating.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is on the installed-package view so its only loading the package you've opened not all of them.


detached: ->
@unsubscribe()

Expand Down
5 changes: 5 additions & 0 deletions spec/fixtures/package-with-config/main.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports =
config:
setting:
type: 'string'
default: 'something'
6 changes: 6 additions & 0 deletions spec/fixtures/package-with-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "package-with-config",
"version": "1.0",
"repository": "https://github.com/example/package-with-config",
"main": "main"
}
14 changes: 14 additions & 0 deletions spec/installed-package-view-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,17 @@ describe "InstalledPackageView", ->
view = new InstalledPackageView(pack, new PackageManager())
keybindingsTable = view.find('.package-keymap-table tbody')
expect(keybindingsTable.children().length).toBe 0

it 'should load the config for inactive packages', ->
atom.packages.loadPackage(path.join(__dirname, 'fixtures', 'package-with-config'))

waitsFor ->
atom.packages.isPackageLoaded('package-with-config') is true

runs ->
expect(atom.config.get('package-with-config.setting')).toBe undefined

pack = atom.packages.getLoadedPackage('package-with-config')
view = new InstalledPackageView(pack, new PackageManager())

expect(atom.config.get('package-with-config.setting')).toBe 'something'