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

[scide] Fix classname highlighting before introspection available #5438

Conversation

jrsurge
Copy link
Member

@jrsurge jrsurge commented May 3, 2021

Purpose and Motivation

This aims to fix issue #5434.

Introduced in #4890 on develop, classnames would not highlight correctly if a file was opened before introspection was available.

This PR prevents highlighting until introspection is available, and triggers highlighting when introspection changes.

Why did this break?

The classname highlighting was broken and formatted everything beginning with an uppercase letter.

The changes in #4890 mean that classnames now have to exist before being highlighted, which means we need to wait for introspection before highlighting them.

Why not use the old behaviour until introspection is available?

It would highlight things incorrectly and then magically correct itself, which could be confusing.

Why not highlight everything else and only highlight classnames when introspection becomes available?

Ultimately, I think it would be more confusing to have a file partially highlight and then have things magically appear.

Old behaviour

  • A file would have different highlighting depending on when you opened it and the state of introspection.

New behaviour

  • No highlighting will occur until introspection is available.
  • When introspection becomes available, all highlighting will be applied.

Types of changes

  • Bug fix

To-do list

  • This PR is ready for review

@jrsurge jrsurge changed the title Fix classname highlighting before introspection available [scide] Fix classname highlighting before introspection available May 3, 2021
@jrsurge jrsurge added bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. env: SCIDE labels May 3, 2021
@@ -89,7 +89,7 @@ class SyntaxHighlighter : public QSyntaxHighlighter {
SyntaxHighlighter(QTextDocument* parent = 0);

private:
void highlightBlock(const QString& text);
void highlightBlock(const QString& text) override;
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious - why is the override keyword needed now and not before? Or - was part of the problem that this wasn't marked as override properly?

Copy link
Member Author

Choose a reason for hiding this comment

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

it wasn't there before, this is very much a "leave the code better than you found it" commit

Copy link
Member

@joshpar joshpar left a comment

Choose a reason for hiding this comment

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

I just had one comment / question, but otherwise think this looks fine. thanks!

@dyfer dyfer merged commit e5bf488 into supercollider:develop May 3, 2021
@dyfer
Copy link
Member

dyfer commented May 3, 2021

Works as expected so I merged this. Thanks @jrsurge and @joshpar !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. env: SCIDE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SCIDE doesn't highlight class names when loading files at startup from a session
3 participants