0 votes
by (1.3k points)
Specifically, has anyone made improvements to this one: https://github.com/monospaced/sublime-twee?

Or perhaps rolled your own? I like seeing color. It's helpful. But, I think this version I have stuffs up some things. So, I was curious to see if anyone has a better way to see color. I have this huge big passage, and the syntax highlighting just stops mid-way down. I don't know if it's just because sublime reached its limits, or because the syntax file got confused.

Anyway, anyone tried to fiddle with this side of things?

1 Answer

0 votes
by (156k points)
selected by
 
Best answer

NOTE:
That language plugin as made to handle TWEE and the macro syntax of the Twine 1 vanilla story formats, and it supports the default list of macros that come with them.

SugarCube uses the same macro syntax which is why it is partly supported by that language plugin, although the plugin has no knowledge of any of the additional macros that SugarCube has, nor about any of SugarCube's extended features.

 

has anyone made improvements to this one

Based on the "Insights - Network" page of that repository it was last updated 24-mar-2016, and that repository has only been forked by one user named Sorbus. This Sorbus user has made a number of updates to their copy of the language plug, which you may be interested in.

 

 I have this huge big passage, and the syntax highlighting just stops mid-way down.

Without an example of the "huge big passage" it is difficult to debug the issue you are having, and to recommend a  means to resolve it.

by (1.3k points)
edited by
Well, I mean, I was really asking if someone had fiddled with it for their own use (and improved it), and might be willing to share.

What Sorbus did with his fork is to discard all syntax highlighting except for Harlowe's. So, it's really only useful for the people that use that format.

In my understanding, you'd need to get the language dev package for sublime, in order to possibly work with these language files, or publish a new version based on your edits.

And I might go do that at some point, since it's obvious the syntax is in need of updating, given the advances of sugarcube.

Here's a pic of how it currently messes up:

https://ibb.co/iVDOsG

So, you can clearly see that it has issues with <</if>>? I think that's because it rather expects the old way of terminating <<if>> statements, whatever that was. <<end-if>>? Something like that.

And from the pic, you can see how it breaks, by the preview of the file on the right. Becomes overloaded? Confused. I dunno. But, I'm pretty sure the language syntax needs some correction to resolve it.
by (156k points)

The vanilla story format's use an <<endmacroname>> syntax (eg. <<endif>> and <<endsilently>>) for it's container (*) closing tags. As these story formats only had two built-in macros that required an end tag I believe the plugin developer used a short-cut when implementing it.

The related code lines in that language plugin's files are:
1. Twee.JSON-tmLanguage#L70 
2. Twee.tmLanguage#L202

(*) macros that have a body in which you can embed other macros.

by (1.3k points)
Yeah, I guess I can work to correct things at my end. I've looked up the docs, and I think by changing the uuid, I can have a publishable language definition at the end, if all goes well. As like Sorbus did, I'll only service sugarcube2/JS/CSS syntax, since that's the only thing I use, or care to use. Also, I'm not sure both language files are necessary. I think at least sublime 3 understands YAML-formated syntax files. Converting JSON into YAML is easy, so at least I'm gonna start with a workable base. Wish me luck!
by (1.3k points)
Well, correcting someone else's work is a lot easier than whipping something up yourself. For now, I have just made some edits the the original syntax file. But, there are things the should be included beyond what the current structure allows for. New patterns. Also, a lot of the html/css/js pattern matching it's doing could be offhanded to the relevant syntax files for those.

I worked out why the syntax was cutting off. It came down to line length. After a certain length, highlighting gets shut off. So, do fix this, I broke the block of text up by using line-continuations. It makes sense to do that anyway, since I intend to insert more there, and it's easier to see the starts/stops of the sections.

I probably will work on my own syntax file, but I wanna get back to just writing. So, it'll be a background project. I'll leave it here, but maybe bring this back up if I have something to share.
Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...