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

GDScript: Add tests for highlighter #88910

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dalexeev
Copy link
Member

0002
>>>>
0003 class InnerClass extends RefCounted: pass
>>>> Kw SN SKw SEt S Cf
Copy link
Contributor

Choose a reason for hiding this comment

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

Yyyyyeah, we need to discuss this somewhere. The arbitrary character count for each identifier is very prone to confusion and hard to decipher. At the same time, so would be using a single character.

@Mickeon
Copy link
Contributor

Mickeon commented Dec 21, 2024

I think this system would greatly benefit from the ability to define highlighter placeholders for each individual test, but I have absolutely no idea on how to go about that.
No matter what suggestions one could have about the current choices, having to maintain COLOR_INFO could be troublesome, and it's somewhat tedious to decipher when reading and writing these tests.

@Mickeon
Copy link
Contributor

Mickeon commented Dec 21, 2024

There's an alternative approach I'd like to propose. Instead of printing the highlighting per-line, it could be printed for each type of highlighting. As a silly mockup based on the PR's test:

N at:
	1: 5, 
	2: 5, 10, [...]
symbol_color at:
	1: 4, 7, 11, 15, [...]
keyword_color at:
	1: 8, 
	2: 1, [...]

@Wierdox
Copy link
Contributor

Wierdox commented Dec 21, 2024

Assuming my PR is added, here's some ideas for tests of StringName/&&/&. I don't have experience in this area though.

# & should be symbol colored.
true \
&& true
1 \
& 4
& "error" # If your test allows errors.

# & next to quote should be StringName colored, unless it is exactly '&&""'.
var sname := &''+&""

sname&&&""
sname&&""

godot windows editor x86_64_OAWeqlbnwY

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.

No unit tests for GDScript code highlighter
3 participants