-
Notifications
You must be signed in to change notification settings - Fork 17.3k
Conversation
4300008 to
629a0a5
Compare
7b38b09 to
9a40239
Compare
Fixes the case where `pane:reopen-closed-item` is called and the item happens to be a URI for a package whose activation is deferred
|
@BinaryMuse I think this is ready for a review. Interested in hearing if you have any alternative approaches in mind :). |
|
I think this is a great change. The I'm wondering if this will break any assumptions that packages would previously have made regarding the timing of the call to Previously, packages' /cc @atom/maintainers Thoughts? Is it ok to change the timing in this way? If not, should we just attach the workspace element to the DOM before we do any deserialization? |
|
@maxbrunsfeld If it isn't too much trouble, I would prefer we maintain the assumption since many packages immediately start working with the DOM on activation. It could be quite disconcerting to try and figure out why 1 out of 15 times it doesn't work. |
8920450 to
eb4cd11
Compare
…/atom into wl-deserialize-and-activate
|
@maxbrunsfeld I've delayed package activation until initial package activation in order to preserve the activation timing. However if initial packages have already been activated by the time the deserializer is called, activate the package immediately. |
This avoids nested atom.workspace.open calls, which don't work well, and has the same effect as createItemForURI will call the newly-added opener.
…ialize-and-activate
…ialize-and-activate
|
Hey! 👋 We have recently started using This is good news: now the Atom code is more consistent and it's much easier to re-format the code to follow the codestyle (now you only need to run This change caused conflicts on your PR that we have automatically solved, hope you don't mind 😄 With ❤️, the Atom team. |
|
❤️ Thanks @50Wliu. This is an important improvement, especially fixing the holes in the serialization scheme. |
Requirements
Description of the Change
This PR unconditionally activates packages when a deserializer for that package is called. It also adds a new way of deferring package activation through the
workspaceOpenerskey. Supply it an array of workspace opener filepaths/URIs that your package watches for and it will remain deactivated until one of those openers is called. This is useful when used in conjunction with deserializers, which often are created using workspace openers.To demonstrate how a package would benefit from this PR, consider a package that listens to the opener
atom://exampleto create a newExampleViewthat has a serializer.atom://exampleis listed as a workspace opener inpackage.json. Theexample:open-example-viewcommand callsatom.workspace.open('atom://example')and is listed as an activation command inpackage.json. This package structure is in use by packages such as Timecop and Markdown Preview.Previously, there was no way to safely defer activation for a package that implemented serialization because it would not be activated when deserialization occurred.
pane:reopen-closed-itemwould throw anEINVAL: open atom:\exampleerror on Windows due to the workspace opener not being registered.workspaceOpenersregisters a dummy opener for the opener that then activates the package and calls the real opener.Alternate Designs
There could be another key added to deserializers stating whether or not that deserializer should activate the package.
Why Should This Be In Core?
Deserializing happens in core.
Benefits
Deserializing, openers, and deferred activation techniques can be used together.
Possible Drawbacks
Perhaps there are some deserializers that don't need the package to be activated? In which case this will slow down Atom's load time unnecessarily.
Applicable Issues
Closes #16099