-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Commenting multi-line code may lead to unnecessary warning #33687
Comments
Using parentheses to wrap a statement over multiple lines should avoid this issue, while generally being easier to refactor: func new_issue():
if (
'Roses' == 'blue'
# and 'Violets' == 'blue'
and 'Sugar' == 'sweet'
):
print('And so are you.') It'd still be good to fix this issue if possible. |
Fixing it would also allow you to avoid the frown at the end of your if statement. |
Actually, this problem is because colon missing at the end of if - or func-line, so the next line will confused and show the mistake in the degugger. For C and C++ the syntax you give is ok, but for godot make some problem like python. |
it's not a bug, its an expected behavior the symbol "\" means just ignore the next new line character in python if True and True\
## comment
or False:
print("test")
## output error
File "test.py", line 3
## comment
^
SyntaxError: invalid syntax in c++ #define TEST \
if (true){ \
// comment
print_line("test"); \
}
// this is also an invalid define macro and also having even an extra white space after the "\" character is invalid if 'Roses' == 'blue' \
# and 'Violets' == 'blue' \
and 'Sugar' == 'sweet':
print('And so are you.') the gdscript tokenizer sees it like this if 'Roses' == 'blue' # and 'Violets' == 'blue' and 'Sugar' == 'sweet':
print('And so are you.') |
Closing as per above comment. |
Godot version:
3.1.1 stable
OS/device including version:
Kubuntu
Issue description:
Commenting multi-line code may lead to unnecessary warning.
Steps to reproduce:
Type some code with multil-ine code:
Then comment some line(s) inside:
As you can see, this produces a red warning, even if the code without this line is syntactically correct.
The text was updated successfully, but these errors were encountered: