Looking forward to switching my text-processing and coding workflows to Nova! I’ll need to make some text processing “macros” (mostly Replace Alls and simple if/then logic). Extensions are the way, it seems. I have a background in JS among other languages.
I’ve started a new Editor Extension and it’s an empty window… where do I learn what to do with that window? Thanks in advance!
(Do I locate the new extension in Finder, Show Package Contents, and start editing the files it contains?)
Also, I am searching the API Reference… but I’m not finding how to get the selected text and modify it. (If I can can just do that, my needs will soon be met!)
For posterity: I don’t know if it’s an ugly hack or exactly the right process… but Show Package Contents and editing the .js and .json within does indeed work.
Then to test your work-in-progress, you must repeatedly Activate Project as Extension, unless there’s some better workflow I haven’t found yet.
I have now made the 10 features missing from Nova that I needed! (Only a couple might be useful enough to share though.)
And FWIW here’s a code snippet for modifying the current selection (Replace All in this example):
var range = editor.selectedRange;
var txt = editor.selectedText;
txt = txt.replaceAll("FROM", "TO"); //Replace All example
If you “Activate as Extension” Nova will run your extension and if any files inside your .novaextension change it will restart the extension.
I have this little non-published extension for my custom text-based commands, if that’s interesting for reference, and it has some docs about how I setup and develop the extension. https://github.com/robb-j/nova-doofer.
Thanks! Useful resources.