idleberg / atom-evaluate

Runs JavaScript, TypeScript, CoffeeScript, and LiveScript directly in Atom
MIT License
2 stars 0 forks source link

[Feature Request] Make it possible to `evaluate` in two steps. #1

Closed ghost closed 7 years ago

ghost commented 7 years ago

This package can easily be classified as an essential tool for developing packages for Atom. Evaluating Coffeescript code while developing a package was pain up to now. Thank you Sir for renewing this effort!

Please allow me a feature request - Make it possible to have the evaluation process in two steps:

  1. Select and identify the code to run.
  2. Execute the code.

These could be for example be exposed to the user as evaluate:hold and evaluate:release. It would be helpful to be able to repeat release several times.


Motivation with the following example: I am developing some Package that modifies text within an active editor. Evaluating the code in the current way, would execute the task to the code being developed.

A two step evaluation process makes it possible to..

  1. Select the code being developed and mark it for evaluation
  2. Activate the editor where the test text sits that needs to be processed by the developed program.
  3. Trigger the execution of the code.

A future phase (not asked now) that I can see -

  1. A bar with buttons
  2. A teach function mode links (hold) a button to a selected code.
  3. In execution function mode, pressing the button does the release action of the hold linked to it.

This future phase can be (maybe) made possible using the evaluate package as a dependency for a new package.

Regards. - Dan Padric

ghost commented 7 years ago

PS: I like the new name. Simple. Straight forward.

idleberg commented 7 years ago

Make it possible to have the evaluation process in two steps:

  1. Select and identify the code to run.
  2. Execute the code.

I have no idea what you mean by that? You can already select the portion you wish to evaluate. As of v0.8.0 this even works with multiple selections, so you can skip code between selections.

ghost commented 7 years ago

Hello. You have been quite busy ..nice!

Let us say we have two panes open. On the left is a text file. On the right is some code with:

_editor = atom.workspace.getActiveTextEditor()
_editor.setText("Hello world")
  1. I highlight the above code.
  2. Invoke evaluate:run-code

What will the code do? Where will the message appear? - left (text) or right (code) What do I do to have the code write in the text pane?

idleberg commented 7 years ago

What will the code do? Will it capture the active editor on the right or the text on the left?

Why don't you simply try it out yourself?

What do I do to have atom.workspace.getActiveTextEditor() point to the left pane?

This question is unrelated to this package

ghost commented 7 years ago

[sad] I know what it will do. Sorry to have wasted your time. Bye.