My games are Twine, but I never used Twine itself, preferring text files compiled to Twine with something like twee2. So I write in a text editor, mainly gedit* so far.
I would like to know if you have any recommendations for a text editor (or an IDE) that can be easily adapted to a custom language. No editor has support for Harlowe or Sugarcube (or, even worse, the custom pseudocode that I’m using for my stuff), so I would like an editor where you can easily add that support. The important word being “easily”.
Features that I’d like to have:
Folding complete passages (that is, being able to configure “::” as the point to fold stuff)
Navigating passages the way editors let you navigate functions, classes, etc. (that is, being able to configure “::” as a thing to be indexed)
Other nice stuff? Macros. A nice, minimal interface (I’m not going to use 99.99% of the dev functions after all). Selecting text and surrounding it with something (so you can write something and then put it inside a hook or whatever).
I’d be really grateful for any suggestion.
*For the record, I’ve configured more or less easily both syntax highlight and snippets for gedit. I also use Brackets, but not much because configuring custom syntax highlight seems like a nightmare.
After a quick search, I’ve just found there exists a Twee2 extension for VS Code. I don’t know if it’s good, though.
Adding support for a simple language in VS Code is not that hard, but it takes some time and you have to know a bit of regex. It took me several days, or maybe more than a week, to write an Inform 6 extension (but I was reading the DM4 in parallel, so a lot of time went into reading.)
I’ve just looked the VS Code site and it literally mentions implementing a language server to fully support a new language… But if there’s a simpler way I can probably get my head around it, I know my little bit of regex.
A language server is mainly used to analyse your code while you’re writing it, so that it can show your errors, display the description of functions when you hover them, suggest intelligent autocompletion… Things like that.
You might want to check out TextAdept. It’s pretty solid, has all the features you want (I think), and it’s very easy to add lexers for new languages and customize in pretty much any way you can think of with a bit of Lua. It comes with lexers for tons of languages, so you can take an existing one that’s similar to the language you need and modify it pretty easily.
The author is also super helpful, if you get stuck or need help.
It’s more on the minimal (text editor) end of the spectrum though, definitely not an IDE.
Vim’s a good suggestion too. Can be difficult to get used to modal editing coming from something like gedit, though. That reminds me, regarding TextAdept:
It is modeless and uses familiar keyboard shortcuts (like basically any other editor or text input thing besides Vim or Emacs).
Code folding, snippets and macros are built-in.
Autocomplete and inline help are built-in, but don’t pop up automatically. Use ctrl-space for autocomplete, ctrl-h for inline help.
Ctags support is built in (for autocomplete, inline help, jump-to-definition).
You’re on your own for Twee syntax highlighting, most likely. Intersection between the two user bases is probably close to zero.
Actually, TextAdept comes with both a GUI version (GTK2/Scintilla) and a terminal version. The terminal version is more vim-ish, with mark-based selection and some less obvious keyboard shortcuts. But the GUI version is quite good.
After much testing, I’ve finally settled on a slightly convoluted setup but it doesn’t require much tech knowledge. In case it can be of use…
My text editor is Visual Studio Code with a number of extensions.
The native snippet function is simple to configure and lets you insert any template with just the tab key.
For a passage index, I found a bookmark panel extension: I define each passage name as a bookmark, and the list appears in the side panel.
There is a Twee format extension that provides some basic syntax highlight for Twee. I was utterly incapable of extending it, but I found a highlighter extension where you define certain regexes and it highlights the matches with whatever custom formats you define, way simpler.