How to name a package of an atom?

I installed the atom-runner package . I want to create a custom command to execute from the palette in order to save the current file, and then execute the runner. Getting the editor and saving the file.

runner:run doesn't work like AtomRunner.run()

atom.workspaceView.command 'MyEntry:runner', -> editor = atom.workspace.getActiveEditor() editor.save() runner:run

+4
source share
2 answers

To invoke the Command Palette command from code, you can use atom.workspaceView.triggerand specify the command name as a string. For instance:

atom.workspaceView.command 'custom:runner', ->
  editor = atom.workspace.getActiveEditor()
  editor.save()
  atom.workspaceView.trigger 'runner:run'

custom:runner, Atom , Atom init.coffee. " " ( - , ), my-entry:runner.

+5

, 1.9.x :

atom.workspaceView.trigger 'runner:run'

, :

editorView = atom.views.getView(editor)
atom.commands.dispatch(editorView, 'runner:run')
+2

Source: https://habr.com/ru/post/1548221/


All Articles