-
-
Notifications
You must be signed in to change notification settings - Fork 415
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
Fix indent detection when lexing docstrings that contain whitespace-only lines. #2131
Conversation
src/libponyc/ast/lexer.c
Outdated
if(ws_this_line < ws) | ||
if(!isspace(c)) { | ||
has_non_ws = true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need the {
/}
braces for this - the prevailing style in this codebase is to omit braces when the body is just one statement.
if(!isspace(c))
has_non_ws = true;
Also note that if the braces were to be included (for a multi-line if
statement), the prevailing style is to place the opening brace on its own line:
if(!isspace(c))
{
has_non_ws = true;
some_other_statement();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, i still struggle to get my editor (and my head) to respect those formatting rules.
8570bdd
to
62fe392
Compare
This is ready to merge when CI passes. I added the changelog label and edited the ticket title to read like a changelog entry, so that the automatic changelog bot can do its work. Thanks! |
Thanks @mfelsche |
one small request for the future @mfelsche the "fixes" is nice ideally information about the "why" would be in the commit message itself rather than just a link to the issue. the best case for the body of that commit would be an explanation of the problem as well as a link to the github issue. |
Point taken. I have to admit i was in a great hurry when i pushed and opened the pr. Will take more care on future contribution. |
thanks @mfelsche |
fixes #2130