-
Notifications
You must be signed in to change notification settings - Fork 354
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 and hinting #1101
base: main
Are you sure you want to change the base?
Conversation
cli/app.rs
Outdated
row.add_cell( | ||
Cell::new(content) | ||
.set_alignment(alignment) | ||
.fg(COLORS[idx & COLORS.len()]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you meant %
, not &
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lol yes thanks
Cell::new(name).add_attribute(Attribute::Bold) | ||
Cell::new(name) | ||
.add_attribute(Attribute::Bold) | ||
.fg(Color::AnsiValue(49)) // Green color for headers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the headers need to be the brightest parts of the table view. They're already the first line you see. We can make them a bit dimmer with AnsiValue(9)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AnsiValue(9)
in this case would make the header red it would not dim it. To make it non bold you have to remove the Attribute::Bold. Regardless, I think this configuration could be the default and you can have a config file to change these little things to your preference.
@@ -196,6 +196,8 @@ macro_rules! query_internal { | |||
}}; | |||
} | |||
|
|||
static COLORS: &[Color] = &[Color::DarkRed, Color::DarkGreen, Color::DarkBlue]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can probably throw Color::DarkCyan, Color::DarkMagenta, Color::DarkYellow
in there as well so it doesn't repeat immediately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it could be a good default, I have to see how it would play out with a config file. I will get back to this after I have a configuration in mind
Start of syntax highlighting and hinting. Still need to figure out how to sublime-syntax works to produce good highlights.
Edit:
Personally, I believe there are more interesting syntax highlighting possibilities with
reedline
crate, but currently, we cannot use it as the our DBConnection
would have to beSend
. This PR is an introduction and quality of life changes for the users of the CLI and for us developers, as we now won't have to look at black and white text only. I want to have a config file to personalize the color pallets, that will be made in a following PR.