-
Notifications
You must be signed in to change notification settings - Fork 226
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
feat: implement syntax highlighting for preview text #568
feat: implement syntax highlighting for preview text #568
Conversation
a87dcf2
to
58388b5
Compare
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.
Awesome.
Just remember to run cargo fmt --all
.
58388b5
to
cf5dedd
Compare
Co-authored-by: Adam Perkowski <adas1per@protonmail.com>
Co-authored-by: Adam Perkowski <adas1per@protonmail.com>
and remove Cargo.lock |
Don't remove it if you're adding deps. |
Did the Cargo.lock ci check get removed? |
It did because |
makes sense |
Please take a look at the check. |
2b583d8
to
6726338
Compare
already on it |
This causes a reversion by removing functionality added in #202. |
Yeah, that'll have to get sorted out. I'll have to take a deeper look into breaking up the lines on overflow, since it gets a little complicated with the unrendered ansi sequences in the raw strings |
Just perusing the docs a bit, this shouldn't be too hard. I'd probably still use a flat map, just over the constructed lines rather than the raw text to preserve the styling and accurately determine the width of the actually rendered text |
@lj3954 why are we looking at wrapping rather than side scrolling? |
Oh I like side scrolling a lot better. |
Me 2, but there's also the issue of altered semantics of a mid line break without also inserting a trailing* backslash, and even then I'm not sure that backslashes are valid at any arbitrary location* |
2298001
to
e570f30
Compare
@ChrisTitusTech @lj3954 just implemented side scrolling to fix regression |
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.
v_scroll
and h_scroll
could be renamed to scroll_v
and scroll_h
but it's not that big.
get_lines should not take in an owned String, the split method is implemented for str instead. The lines() method also is more idiomatic than split("\n"). |
e570f30
to
0aa035d
Compare
0aa035d
to
a70a6bb
Compare
good catch, that was pretty sloppy |
This was accidentally left in from benching
Tree-sitter is a permissively-licensed, open-source parser framework, well known for its integrations in many popular editors (i use nvim, btw). Luckily, they provide Rust bindings that are reasonably straightforward to use. This PR implements syntax highlighting for the source preview, making it much easier to read for people wanting to understand the code behind commands that they are running.
Type of Change
Description
Testing
Manual testing by perusing the previews of various commands
Impact
This should make it much easier to understand the source while being presented in the preview
Checklist