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 Syntax Highlighting Issue for Special Characters in Level 2 #5480

Merged
merged 4 commits into from
Apr 29, 2024

Conversation

JoseArtur
Copy link
Contributor

This PR addresses a syntax highlighting issue in Level 2.
Previously, if an exclamation mark followed a variable, it was still considered valid, but the syntax highlighter did not reflect this correctly.

For instance, in the command:
name is Hedy print name is name
The keyword name was highlighted in blue in all occurrences. However, if an exclamation mark was added to the end of the command:
name is Hedy print name is name!
The keyword name was only highlighted in blue in the first occurrence.

To resolve this issue, I have introduced a SpecialChar token to the grammar file.
This token includes an exclamation mark (!), question mark (?), and period (.) characters.
With this change, the syntax highlighter correctly recognizes and highlights the variable name even when a special character follows it.

Fixes #5089

How to test

Follow these steps to verify this PR works as intended:

name is Hedy 
print name is name!
  • Check that name is highlighted in all occurences
    image

@JoseArtur JoseArtur force-pushed the special_char_highlight branch 3 times, most recently from dd460a8 to e1f7526 Compare April 27, 2024 21:01
Copy link
Member

@Felienne Felienne left a comment

Choose a reason for hiding this comment

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

Hola @JoseArtur!

Thanks for your first PR and welcome to Hedy!!

I can confirm this solves the issue:

image

Copy link
Contributor

mergify bot commented Apr 29, 2024

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

@JoseArtur
Copy link
Contributor Author

Hi @Felienne .
it's a pleasure to be part of hedy :).

Copy link
Contributor

mergify bot commented Apr 29, 2024

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 7b9f2b4 into hedyorg:main Apr 29, 2024
10 checks passed
Copy link
Contributor

mergify bot commented Apr 29, 2024

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

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

Successfully merging this pull request may close these issues.

🪲Variable is not highlighted if followed by an exclamation mark
2 participants