Skip to content

Allow sequences of commands#3

Open
luisdavim wants to merge 4 commits intohurrymaplelad:masterfrom
luisdavim:master
Open

Allow sequences of commands#3
luisdavim wants to merge 4 commits intohurrymaplelad:masterfrom
luisdavim:master

Conversation

@luisdavim
Copy link

Hi,

This PR is regarding the issue #1
Please note this is my first time with coffee script :)

Luis

Copy link
Owner

@hurrymaplelad hurrymaplelad left a 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

package.json Outdated
"name": "alias-command",
"main": "./lib/atom-alias-command",
"version": "1.0.1",
"version": "1.0.2",
Copy link
Owner

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>

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
Copy link
Owner

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.

Copy link
Owner

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants