UPDATED 2019-09-10, around 09:30am PDT
2019-09-10, around 09:30am PDT: I discovered how to no longer need the "shebang" in your script file.
2019-09-10, around 08:30am PDT: I found what I think is a much easier way to run JXA code from VSCode. So I've rewritten most of this post.
Visual Studio Code (VSCode)
VSCode vs. Atom
As far as compiling and running JXA scripts, I think they're about the same. There's no debugging that I'm aware of in either of them.
Download the Mac version from https://code.visualstudio.com/. If memory serves, you have to unzip it, then drag the app to the Applications folder.
Then (1) Click the Extensions button on the left, (2) Search for "Code Runner", and (3) Install it:
You'll probably also want to install the "AppleScript" extension, which also supports JXA (more on this later):
"Code Runner" vs. "AppleScript" extension
Both of these extensions add support for running JXA scripts. I'm going to explain what I think is the best way to use either of these.
You can now edit your JXA scripts with full editor support, as mentioned above.
Running JXA Scripts with the "Code Runner" extension
The easiest way to run your JXA scripts is with the "Code Runner" extension.
1) Edit your user settings:
Shift+Command+P, type in "user settings", and "Open User Settings":
It's a standard JSON file. Yours might be empty. Add the lines shown in yellow, and optionally add the lines shown in green:
2) Use the "Code Runner" extension to run the code.
Here's some ways to do that:
Shift+Command+Pto bring up the command window, and type in "Run Code:
Use the "Run Code" shortcut as shown above,
Compiling and Running JXA Scripts using the "AppleScript" extension
If you installed the "AppleScript" extension, you can use it to save compiled versions of your script.
When you're ready to compile or run your script, do the following:
Follow the instructions in the "AppleScript" extension for how to compile.