-
-
Notifications
You must be signed in to change notification settings - Fork 118
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
Clean up render snippets #324
Conversation
92caee6
to
997a3ea
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.
I'm not confident that the x_conts.line(), x_conts.line_count()
-> x_line, x_line_count
change is actually more readable personally, but don't feel strongly about it. It would probably also be good to add a test for the combined-context bug in tests/graphical.rs
. The rest of this looks great to me.
I thought this change was necessary because I removed the vector of |
The previous test would still have overlap between the first and last context because of contexts are extended with `context_lines`.
Also added a test for non-adjacent contexts, which shows that each context gets a header that points to the code in the context :D Lines 1791 to 1802 in e16326a
|
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.
New version looks really good to me :)
Thanks for this! |
Hey, here are some local changes I made that might be useful.
In the first commit I tried to make the
render_snippets
function more readable and fixed what I think was a bug.(Looks like it would not merge more than two contexts if the last context didn't overlap the first)
In the second commit I restricted finding the primary label to those in the current context.
This makes it so that the header above each snippet points to code in the snippet.
(It is especially useful for
SourceCode
implementations that wrap multiple files)Example showing different headers for different snippets: