cyrusfirheir / twee3-language-tools

[ VSCode extension ] Syntax highlighting and programmatic language tools for Twee 3, and Twine 2 storyformats.
https://marketplace.visualstudio.com/items?itemName=cyrusfirheir.twee3-language-tools
MIT License
47 stars 16 forks source link

Harlowe StoryMap missing arrow links between passages when changers are used #154

Open hawkerm opened 11 months ago

hawkerm commented 11 months ago

I noticed with Harlowe, if not using straight links to passages [[Text|Passage]] and things like:

Then the StoryMap graph doesn't show these as links to between the passages in the information sidebar nor with an arrow.

Makes it a bit misleading when there's still a connection between the passages. Would be nice if these could be detected and added to the StoryMap as well.

Related/similar to #76 for SugarCube I think?

Tranberry commented 10 months ago

yes the workaround for SC is to have the twine passage link in a "comment", not sure if that is possible in Harlowe.

<!--[[Text|Passage]]--> something like this.

hawkerm commented 10 months ago

Thanks @Tranberry, looks like the same trick works for Harlowe:

<!--[[Text->Passage]]-->

Would be nice to not have to double-manage and have it automatically picked up still though.

Looks like this may be one of the items on the long todo list in the story map source: https://github.com/cyrusfirheir/twee3-language-tools/blob/master/story-map/todo.md

Poking around, looks like this is the function below which does the detection of the simple links and would need to be updated for the various function patterns for the different flavors:

https://github.com/cyrusfirheir/twee3-language-tools/blob/00f33985ab4e1eb728f94dcd08a2327049d2af8d/src/story-map/socket.ts#L10-L18

Which is called just below in the same file to send this info from the backend to the frontend:

https://github.com/cyrusfirheir/twee3-language-tools/blob/00f33985ab4e1eb728f94dcd08a2327049d2af8d/src/story-map/socket.ts#L38-L56

This eventually creates the LinkedPassage type in the Story Map here via this function:

https://github.com/cyrusfirheir/twee3-language-tools/blob/00f33985ab4e1eb728f94dcd08a2327049d2af8d/story-map/src/util/passage-tools.ts#L32-L37

Not sure of all the various patterns across flavors myself, nor if there's a variable somewhere that stores whatever the editor is set to which could be used here to optimize it. Though, hopefully pointing this out helps someone know how to better fix this scenario. 😊

I think detecting SugarCube and Harlowe could be fairly similar like optional starting ( for Harlowe, some text for other variants, then the goto then an optional : for Harlowe, then the passage name at the end...

Doc links for these special formats:

kilogold commented 8 months ago

+1

Without arrows for goto:, improvements to the editor view become less useful/important. It seems like goto: is the predominant use case in Twine, because only employing simple links can be approximated in almost any tool, even Google Forms.

Mermothle commented 2 months ago

+1

Doesn't show arrows when using "link" macro in SugarCube either. Or "textbox" forwarding.