Live data from Hacker News

Ask HN: What code editors or IDEs are easily scriptable?

news.ycombinator.com

21–30 of 68 posts

Re: Ask HN: What code editors or IDEs are easily scriptable?

#21
post #16

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 purposes, it's a bit overkill, unless/until you have enough of those that bundling them all up into one "my extension with all the Foos I demand" begins to make sense.

Unfortunately local-only, private one-off extensions aren't installed as trivially as dumping just-a-script-file in some dot folder and calling it done. I mean it almost is with `~/.vscode/extensions/my-ext/` but not 100% reliable. I have 2 custom exts in there that are always available but 1 that inexplicably never is (but builds & runs error/warning-free with F5). The official installation story is a "vsx package" (probably just a ZIP but haven't looked into it yet).

Re: Ask HN: What code editors or IDEs are easily scriptable?

#23
post #2

Do VScode and Jetbrains's plug-ins /extensions satisfy your scripting needs? They're in JS and Java, I think.

For Jetbrains IDEs, I recommend using LivePlugin rather than building a full-blown plugin for every script: https://github.com/dkandalov/live-plugin

Re: Ask HN: What code editors or IDEs are easily scriptable?

#26
post #6

Kakoune _barely_ has a scripting language. It has essentially a set of commands and some basic string substitution, one of which will let you drop to a shell (something akin to substitute this string with the result of evaluating its contents through bash). With this you can write your scripts in whatever language you like. My plugins are almost all in Rust, some are in bash.

Another vote for Kakoune. I think most people will find its approach a bit obtuse at first, but once it starts to click it’s pretty interesting.

Maybe if you’re a seasoned terminal veteran it will make more sense to you right outta the gate. I started using Kakoune not long after I started using the terminal much more heavily, so it was a bit difficult at first, but it has been and continues to be rewarding.

For example, select some text and press the pipe character, and then you can enter a script or shell command (sort, uniq, fmt, etc.). The selected text will be fed to stdin of the command, and then will be replaced with the output.

Combine this power with multiselections, which can be operated on in separate contexts, and you’ve got a stew going.

Re: Ask HN: What code editors or IDEs are easily scriptable?

#27
post #2

Do VScode and Jetbrains's plug-ins /extensions satisfy your scripting needs? They're in JS and Java, I think.

In my experience, VS Code’s extension system really shines here. There are also boilerplate repos out there to get started.

> There are also boilerplate repos out there to get started.

Should be unnecessary (and might be outdated unless meticulously maintained) IF one chooses to just follow the VSC API docs' `yo code` approach. Which generates the project structure with a simple hello `extension.ts` IIRC.

Re: Ask HN: What code editors or IDEs are easily scriptable?

#28
Sublime 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"

Re: Ask HN: What code editors or IDEs are easily scriptable?

#29
You said no-Lua, but since for many interested in this thread Lua's a non-problem, I'll pitch a disconcertingly under-hyped / under-noticed native (aka non-Electron) editor with Lua extension story (and many of its parts built on that plus its small C core) called TextAdept.

I'm still a happy camper on VSCode but if it ever begins to crumble/rot/overbloat (by subjective criteria), I'd hop onto that. Lua is (for my purposes here) no better/worse than JS/TS. Save for those darned 1-based array indexings!

LSP-capable too, last I heard, else it'd be a non-option for me in 2024. https://orbitalquark.github.io/textadept/

Post reply on HN