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

No syntax highlighting for TSC comments #3

Open
duncathan opened this issue Apr 4, 2021 · 4 comments
Open

No syntax highlighting for TSC comments #3

duncathan opened this issue Apr 4, 2021 · 4 comments

Comments

@duncathan
Copy link

It's a relatively common pattern in TSC, especially more advanced scripts, to leave comments to document your events. Any text in between the end of an event and the label for the next event is completely ignored by the TSC parser. This snippet demonstrates that usage:

#0000
<END

~~~~~~~~~~~~~~~~
RETN instruction
~~~~~~~~~~~~~~~~
#0001
<FL+_RTN
<FLJ_RA0:0002<FLJ_RA1:0002<FLJ_RA2:0002<FLJ_RA3:0002
<FLJ_RA4:0002<FLJ_RA5:0002<FLJ_RA6:0002<FLJ_RA7:0002
<EVE0003
#0002
<TRA0010:2800:0000:0000 Load RA into A

#0003
<EVE0004 Normal return; pop the return address into A
#0004
<EVEXXXX Run codec with _RTN flag set (calls the appropriate function)

Highlighting those sections as comments (e.g. italicizing them, etc) would be a big help for code clarity.

The commands in vanilla TSC which end an event (and thus leave any text after them as comments) are:

  • <END
  • <ESC
  • <EVE
  • <INI
  • <LDP
  • <SLP
  • <TRA
@duncathan
Copy link
Author

image
Here's that same snippet in Booster's Lab, showing the highlighting for comments.

@duncathan
Copy link
Author

On a related note:
image
There seems to be support for comment highlighting following a // as shown. The issue here is that these lines are NOT in fact comments, and will be executed as if they're normal TSC if run ingame (in this case, printing their contents to an invisible message box). This behavior should likely be removed, unless there's a use case I'm unaware of, in which case an option would be nice.

@jozsefsallai
Copy link
Member

This is also something that will be improved in the dedicated TSC library I mentioned in #2 (comment) (and the vscode extension, for the syntax highlighting part); in fact, you will also be able to instruct the language server to warn you about possible unreachable code.

// comments - although non-standard - are supported specifically because Booster's Lab allows them (but eliminates them when converting the script back to TSC). If you open a file from ScriptSource and it has // comments somewhere inside of an event they will look different.

@duncathan
Copy link
Author

Gotcha, I'd missed that feature in ScriptSource. All good on that front then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants