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

Fix region section not ignoring #region and #endregion when in a string #89242

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

RafaelRain18
Copy link
Contributor

When using the script editor, if the keywords #region and #endregion where in a string and at the start of the line, the editor would not ignore them and count them as the actual keywords, which when folded, would only fold until the first #endregion in a string, for example.

By checking if these keywords were in a string, this commit now ensures the editor ignores strings and fold the section correctly.

Fixes #89115.

@RafaelRain18 RafaelRain18 requested review from a team as code owners March 7, 2024 10:20
@KoBeWi KoBeWi added this to the 4.3 milestone Mar 7, 2024
@Kiisu-Master
Copy link
Contributor

Wouldn't it make more sense to add is_in_string check to the is_line_code_region_* functions?
Because right now it means that the is_line_code_region_* functions are still returning incorrect answer.

@akien-mga akien-mga requested a review from a team March 7, 2024 13:47
@RafaelRain18
Copy link
Contributor Author

@Kiisu-Master Yeah, for some reason when I changed it before, it was still giving me the wrong results, so I thought there was something else that I wasn't seeing and I didn't want to break anything else, so I did it this way. But now when I tried it again it now works perfectly.
Should I now close this PR and open a similar one with the changes?

Copy link
Member

@Paulb23 Paulb23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

Code and tests looks good to me.

Any chance you could rebase and squash your commits, we have some documentation here that should help: https://docs.godotengine.org/en/stable/contributing/workflow/pr_workflow.html#updating-your-branch

When using the script editor, if the keywords #region and #endregion where
in a string and ate the start of the line, the editor would not ignore them
and count them as the actual keywords, which when folded, would only fold
until the first #endregion in a string, for example.

By checking if these keywords were in a string, this commit now ensures the
editor ignores strings and fold the section correctly.

Fixes godotengine#89115.
@akien-mga akien-mga merged commit 1bbdbba into godotengine:master Mar 11, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks! And congrats for your first merged Godot contribution 🎉

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

Successfully merging this pull request may close these issues.

Region section is not correctly handled when "#endregion" is set in a string variable inside the region
6 participants