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

VSCode: Unexpected "T" while reading a return statement #388

Open
andresmakesgames opened this issue Sep 15, 2024 · 3 comments
Open

VSCode: Unexpected "T" while reading a return statement #388

andresmakesgames opened this issue Sep 15, 2024 · 3 comments
Labels

Comments

@andresmakesgames
Copy link

What is the current behavior?

The Yarn Spinner VSCode extension reports a problem in my Yarn file, "Unexpected "T" while reading a return statement", when reading the command <<returnToMainMenu>>

Please provide the steps to reproduce, and if possible a minimal demo of the problem:

  1. I created a function in my application "returnToMainMenu".
  2. I defined it in my Functions.ysls.json file.
  3. I added the command to one of my Yarn files.
  4. The Yarn Spinner VSCode extension reports the problem noted above, with the 'T' in ToMainMenu underlined in red.

The only issue is the report in VSCode.
This does not manifest in any problems during execution of the application - the custom function is still parsed and called as expected, and works fine.

What is the expected behavior?

No error message.

Please tell us about your environment:

  • Yarn Spinner Version: v2.4.21 (pre-release)
  • Unity Version: N/A

Other information

I'm somewhat at a loss. I don't know VS Extensions well enough to diagnose!

@desplesda
Copy link
Collaborator

I think this is actually a bug in our parser! The parser is reading “return”, thinking it’s the return keyword, and getting confused from there. (This doesn’t happen with other keywords like if, because those are actually defined to include a space afterwards to prevent this issue.)

@desplesda
Copy link
Collaborator

Until a fix for this lands, you can temporarily work around this problem by changing the name of your command to not begin with the word “return”.

@andresmakesgames
Copy link
Author

Yup, I figured it would be something like that. That makes sense to me! Thanks, Jon. It's not that annoying, and I'll just name the function "backToMainMenu".

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

No branches or pull requests

2 participants