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

Highlight warning lines in Script editor #102469

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

Conversation

sockeye-d
Copy link

Adds a yellow highlight (customizable through the theme editor) to the script editor
image

Resolves godotengine/godot-proposals#11706

@arkology
Copy link
Contributor

arkology commented Feb 6, 2025

I think it may be good (but not necessary) to have transparency check to skip code if alpha is zero.

@sockeye-d
Copy link
Author

I think it should have transparency check to skip code if alpha is zero.

If the alpha is set to zero, warnings are added, then changed in the editor settings to something visible, it won't change until the next time warnings are updated. This is because it won't make the lines a color other than Color(0.0, 0.0, 0.0, 0.0) and so when it updates the line colors it won't find any that match. Also since errors don't do it and it's probably a negligible performance hit I don't think it's worth it

@arkology
Copy link
Contributor

arkology commented Feb 6, 2025

I understand you point.
But at the same time:

Also since errors don't do it

Because users have errors if something is going wrong and usualy errors should be fixed. But there could by many warnings and they could be freely ignored.

This is just a suggestion (I'll rephrase previous comment) and not critical at the first glance.

@AThousandShips AThousandShips changed the title Script editor warning line highlight Highlight warning lines in Script editor Feb 6, 2025
@KoBeWi
Copy link
Member

KoBeWi commented Feb 6, 2025

Checking for alpha would allow skipping double for loop. If setting the background color would have no effect, no reason to run this loop. Same could be done for errors.
Unless I'm misunderstanding something.

@sockeye-d sockeye-d requested a review from a team as a code owner February 6, 2025 20:45
@sockeye-d
Copy link
Author

sockeye-d commented Feb 6, 2025

Done for warnings and errors both, I also added the missing documentation that was causing the Linux mono build to fail I think

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally, it works as expected.

However, I think the default warning mark is too prominent by default and draws attention away from errors.

Default Black (OLED) Light
image image image

With opacity reduced by half on the warning mark color:

Default Black (OLED) Light
image image image

We should remember that many projects out there have dozens of warnings (if not hundreds) that were never noticed by users (and therefore not fixed), so we should ensure we don't highlight warnings too prominentl by default.

editor/editor_settings.cpp Outdated Show resolved Hide resolved
@Calinou
Copy link
Member

Calinou commented Feb 8, 2025

Looks good to me, please squash the commits together. See PR workflow for instructions 🙂

@sockeye-d
Copy link
Author

Commits are now squashed together

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.

Display a yellow background highlight for warnings like errors
4 participants