New VS Code extension for writing Chapbook or SugarCube Twine games

I’ve created an extension for VS Code that supports syntax highlighting, variable reference lookup, autocomplete, and custom inserts/modifiers/macros for Chapbook and SugarCube. It also includes a game build system and plays games directly in VS Code. You can install it from the VS Code marketplace.

16 Likes

I no longer use Twine but I can appreciate the effort required to build this and the utility. If this had been around when I was, I would definitely have tried it out.

4 Likes

Thankfully I’d done the heavy lifting of learning how to write one of these for my ChoiceScript extension a few years ago.

1 Like

Well done.

One small SugarCube related suggestion… …the print macro call you’re using to generate the <div> element at the end of the code example may be better achieved using Attribute Directive markup.

<div class="readout-inner-bar" @style="'border-color: ' + $power_color">blah</div>
1 Like

Thanks! That’s from my game that was out in sub-Q a few years ago but it’s good knowledge for future work.

Also it means the extension needs to watch for those to pass it thru its TwineScript parser and capture variable references.

For the holidays, I updated this extension both to capture those variable references but also to add support for renaming SugarCube or Chapbook variables with F2. It’s reasonably solid, but I expect there’ll be corner cases I didn’t catch, so if anyone sees an oddity, give me a shout!

2 Likes

This is amazing. Before using it, I used notepad++ UDL. This is a much better and more elegant solution, it saves a lot of time and is much more stable. Thank you very much.

1 Like