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

Add enums for sc2 macro definitions #139

Closed JustNoon closed 1 year ago

JustNoon commented 1 year ago

Adding global enums to macro definitions would let code, documentation, and argument validation reuse values for more robust and convenient documentation.

sugarcube-2:
  enums:
    colors: '"red"|"green"|"blue"|"pink"'
  macros:
    coloredbutton:
      name: coloredbutton
      description: |-
        `<<coloredbutton label color>>`

        `label`: What the button says

        `color`: %colors%
      parameters:
        - 'text &+ %colors%'

Global enums can be evaluated when requested or cached after all files evaluated.

Local would be useful too if global are too much. Thoughts?