Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Syntax highlighting inside SugarCube backquotes #133

Open
spikymoth opened this issue Jun 7, 2023 · 0 comments
Open

Feature request: Syntax highlighting inside SugarCube backquotes #133

spikymoth opened this issue Jun 7, 2023 · 0 comments
Labels
sugarcube-2 Relating to the SugarCube-2 Story Format

Comments

@spikymoth
Copy link

spikymoth commented Jun 7, 2023

To pass an expression to a macro, you can either:

  • Pass it via a temporary variable, or
  • Wrap the expression in what SugarCube calls backquotes (`).

I'm not a huge fan of this feature since the syntax conflicts with JavaScript's template literals, but having to set a temporary variable for every invocation isn't great either.

Could you add syntax highlighting support for JavaScript expressions inside backquotes?

Note: Template literals can still be used in macros that expect an expression. For example, compare

<<set _temp = `foo ${$bar} baz`>>
<<link _temp "MyPassage">><</link>>

to

<<link `"foo " + $bar + " baz"` "MyPassage">><</link>>

so disambiguating them might be tricky. On the plus side, I don't think you can pass expressions to custom macros (widgets) except through the backquote syntax.

@MinusGix MinusGix added the sugarcube-2 Relating to the SugarCube-2 Story Format label Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sugarcube-2 Relating to the SugarCube-2 Story Format
Projects
None yet
Development

No branches or pull requests

2 participants