Newbie mode - running javascript with output as console (just like Rubymine)
Good sirs.
I've seen in the documentation how the workflow involves seeing instant results in Chrome.
But how can I get my results (student projects) to display in a built-in console, like RubyMine does. or like http://repl.it does?
When I put open my document and see my code in the window, I choose RUN, and I get an edit config dialog box, which seems like far too much complexity just to run a little algorithm exercise.
Do I have to go through a whole config process for every js file I create and try to run?
Thanks
Please sign in to leave a comment.
Hello!
if all you need is to quickly test your code, without loading it in the browser - just to have some console.log messages printed, I can suggest using node.js for this (if you do have node.js installed)
There are 2 possible ways to do this:
1. via Node.js run configuration
enable Node.js support for the project: make sure to configure Node.js interpreter and sources first (Settings/JavaScript/Node.js and NPM) and then enable 'Node.js vXXX Core Modules' library in Settings/JavaScript/Libraries. This should be enough to make 'Run ' and 'Debug' actions appear in right-click menu of any .js file, so that you can right-click on it to quickly run the code
2. via external tools
- create a new external too (Settings/External tools)
- specify a path to node interpreter as a program
- add $FileName$ as parameters
- set a working directory to $FileDir$
- make sure to check Show in/Project views and Editor menu to be able to run your tool from file right-click menu in Project view/Editor
then you'll be able to run your tool from a right-click menu of your .js file - the file will be passed to node as an argument
It works just like you said.
Thanks!