VSCode has a comprehensive API that you can create scripts for in Typescript
It's pretty rad really: https://code.visualstudio.com/api/ What I like about it is how it exposes pretty much all capabilities with no chance of breaking the editor host itself. Just the right balance of constrained-enough-but-seemingly-unconstrained. You can develop these extensions in JS/TS super-smoothly inside VSC and run-with-F5 to open a new window with your extension running. But frankly for small-script purpo…
Ask HN: What code editors or IDEs are easily scriptable?
51–60 of 68 posts
Re: Ask HN: What code editors or IDEs are easily scriptable?
#52I used to think that it would be better to have a lot of scripting and automation built into my editor, but there are so many well-built, connect-able tools already available in a unix shell that it's usually easier to write scripts in that context, instead. There are often easy ways to pull the outputs of those scripts into your editor or use your editor as a thin, pass-thru layer to run shell scripts on certain selected bits of text in a file.
Re: Ask HN: What code editors or IDEs are easily scriptable?
#53Sublime Text could have been perfect, it uses python and it is hot-reloadable, but the API is limited, you can't extend the interface _at all_, want tabs in the build/task panel? nope, want to customize your status bar with clickeable elements? nope VSCode is a joke, you can't use javascript, worse, you need to compile your scripts, and you need to restart the editor whenever you change your "scripts"
You can use Javascript, you don’t need to compile your scripts if you do you javascript, and you don’t need to restart the editor when you change your scripts. You do have to restart the extension host, but that’s not the same thing.
Re: Ask HN: What code editors or IDEs are easily scriptable?
#54Re: Ask HN: What code editors or IDEs are easily scriptable?
#55Re: Ask HN: What code editors or IDEs are easily scriptable?
#56Of the “preferred not” languages you listed, Lisp and Lisp-derivatives are easily the most pragmatic languages you will see doing “real” work outside of the scripting environment. So, given the dearth of good scriptable editors using other languages, why not give Emacs a try? I will grant that Elisp is a bit of an odd dialect, but a lot of what you learn from learning Elisp will transfer to understanding other langua…
Re: Ask HN: What code editors or IDEs are easily scriptable?
#57Plain old vim doesn't only do vimscript, you can also script it in Perl, Python, TCL, Lua and maybe one more I cannot remember. See e.g. this python howto: http://codeseekah.com/2012/03/04/vim-scripting-with-python-l...
alright I'll put all the filenames in the buffer
ls /tftp/bootroms/foobar/foobar_6.4_*.bin | gvim -
I'll run an awk one-liner to print the filename and date seperated by a tab :%!awk '{ printf("\%s\t", $0); system("strings " $0 " | grep '\''20[0-2][0-9],'\''") }'
I don't want that long path :1,$s:.*/::
I know, I'll sort them by build date :%!sort -r -k4 -k2M -k3n -k5
Oh yuck 4 space tabs don't do it :set ts=16
:set expandtab
:retabRe: Ask HN: What code editors or IDEs are easily scriptable?
#58That said, while I've not done so, it _is_ possible to write Neovim extensions in Python. Check out this project for details: https://github.com/neovim/pynvim
While there are obviously many editors out there these days, IMO the ubiquity of [n]vim and emacs make them strong leaders. Convincing me to use anything else would be difficult.
I love Neovim, and it fits my needs well - but my choosing it over emacs was largely arbitrary. Now I'm in a position where I understand Neovim very well but lack that knowledge of emacs. As far as I know they're on par with each other.
Re: Ask HN: What code editors or IDEs are easily scriptable?
#59Some people live in their editor and occasionally drop into a shell. I've personally found a lot less friction in doing the opposite. Live in the shell, and occasionally drop into your editor. I used to think that it would be better to have a lot of scripting and automation built into my editor, but there are so many well-built, connect-able tools already available in a unix shell that it's usually easier to write sc…
Sure, sure, I do miss tpope’s surround and repeat plugins, but I have shell muscle memory and am happy(ish).
IMHO, of course, YMMV. :-)
Re: Ask HN: What code editors or IDEs are easily scriptable?
#60I think the best IDE scripting experience I know of right now is IntelliJ (or other Jetbrains IDEs) with the Live Plugin extension. You can write simple scripts in Kotlin or Groovy. They're similar langs but the latter is dynamically typed. And then you can just do things like register menu items, explore the language AST, edit buffers, trigger refactorings, access remote machines. Anything, really.
As your script gets too big, you just convert it to a 'real' plugin project with multiple files, can use libraries, etc.
Then you can upload it to the Marketplace so people can find it.
And if your plugin ends up being really good, Jetbrains run a monetization system so you can sell it easily. They handle all the billing, tax, licensing etc for you, so you can focus on your plugin.
It's pretty rad. That said, in years of working with IntelliJ I never felt a need to extend it for my own personal use. It's not like emacs where every user ends up with piles of elisp. The defaults are pretty good, and many features where in other IDEs you'd be forced to write a script can be done entirely via the GUI. For example if you want to define templates that auto-expand and where the cursor moves between 'slots', you can do that using a mini templating language without needing to do any coding. There's a thing called Structural Search & Replace which is similar - it lets you create templates that match against ASTs and do transforms on them.