-
Notifications
You must be signed in to change notification settings - Fork 1
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
Allow sequences of commands #3
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the upgrade!
Mind adding example usage to the Readme.md file, then I'll publish it?
Also, if you're feeling ambitious, test coverage would help me make sure we don't accidentally break this with future changes:
https://github.com/hurrymaplelad/atom-alias-command/blob/master/spec/atom-alias-command-spec.coffee#L3
@@ -1,7 +1,7 @@ | |||
{ | |||
"name": "alias-command", | |||
"main": "./lib/atom-alias-command", | |||
"version": "1.0.1", | |||
"version": "1.0.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I usually leave version bumps out of PRs so the package maintainer can use npm version at release time</minor nitpick>
module.exports = aliasCommand = (as, {orig, scope}) -> | ||
scope ?= 'atom-workspace' | ||
aliasCommand.subscriptions.add( | ||
atom.commands.add scope, as, (event) -> | ||
atom.commands.dispatch event.target, orig | ||
if typeIsArray orig | ||
atom.commands.dispatch event.target, o for o in orig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find great info in the Atom docs about the queuing behavior of commands. For example if I orig: dispatch('core:save')
then dispatch('core:close')
, does Atom guarantee that save will complete before we close the file? Perhaps the two commands can be executed in any order.
We don't need to answer this now if it's working for you. Just something to keep in mind if you notice any flakiness saving.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found these related discussions:
atom/atom#2670 (comment)
atom/atom@9aee7d4
Sounds like Atom core's stance is that composing commands at the dispatch
level is ambiguous (series or parallel? what if one fails?), and that the ambiguity should be resolved by defining a new command that does the desired composition at the JS API level.
Seems to me like a reasonable stance to support with this plugin. Principled objection?
Hi,
This PR is regarding the issue #1
Please note this is my first time with coffee script :)
Luis