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

Syntax highlighting of entity paths and instance paths #4803

Merged
merged 1 commit into from
Jan 15, 2024

Conversation

emilk
Copy link
Member

@emilk emilk commented Jan 15, 2024

What

Adds basic syntax highlighting to patsh. Slashes and brackets are in a fixed bright-white color, while the text uses the color appropriate for the widget it is in (labels are dimmer than button, for instance).

For labels this produces a lot of contrast:
image

For buttons, not so much:
image

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG

@emilk emilk added ui concerns graphical user interface 📺 re_viewer affects re_viewer itself include in changelog labels Jan 15, 2024
@emilk emilk marked this pull request as ready for review January 15, 2024 10:01
@Wumpf Wumpf self-requested a review January 15, 2024 10:20
@@ -26,6 +26,9 @@ all-features = true
default = []

[dependencies]
re_entity_db.workspace = true # syntax-highlighting for InstancePath. TODO(emilk): move InstancePath
Copy link
Member

@Wumpf Wumpf Jan 15, 2024

Choose a reason for hiding this comment

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

move instance path to where?

aren't these making re_ui a lot less lightweight?

Copy link
Member Author

@emilk emilk Jan 15, 2024

Choose a reason for hiding this comment

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

move instance path to where?

It feels like it belongs in a more low-level crate, like re_types

aren't these making re_ui a lot less lightweight?

Yes. The alternative is to create yet another crate, or add more feature flags, and both kind of sucks.

@Wumpf
Copy link
Member

Wumpf commented Jan 15, 2024

quite subtle here as well hmm
image

Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

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

neat! A bit too subtle for my taste, but clear improvement


use egui::{text::LayoutJob, Color32, Style, TextFormat};

pub trait SyntaxHighlighting {
Copy link
Member

Choose a reason for hiding this comment

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

is it actually syntax highlighting or just "make this an egui text"? ToLayoutJob might be just as appropriate

Copy link
Member Author

Choose a reason for hiding this comment

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

Discussed live: we'll probably use this trait for more syntax highlighting stuff in the future, and that's what you want to search for in the code. Still, we can revisit the name later if we want to.

@emilk emilk merged commit e2ec2e5 into main Jan 15, 2024
40 checks passed
@emilk emilk deleted the emilk/syntax-highlighting branch January 15, 2024 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
include in changelog 📺 re_viewer affects re_viewer itself ui concerns graphical user interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Entity Path syntax highlighting
2 participants