-
Notifications
You must be signed in to change notification settings - Fork 77
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
core: Make print_string aware of indentation #2809
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2809 +/- ##
=======================================
Coverage 89.81% 89.82%
=======================================
Files 396 396
Lines 49010 49047 +37
Branches 7503 7508 +5
=======================================
+ Hits 44018 44056 +38
+ Misses 3803 3802 -1
Partials 1189 1189 ☔ View full report in Codecov by Sentry. |
Amazing, I was just implementing it locally! |
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.
great timing, I also need it for pretty syntax in the kernel ops
I would say that the previous behaviour was also not intuitive, and the new functions add some more structure, so we're better off with the new functionality. |
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.
Very cool
This PR makes the
print_string
function in the printer aware of indentation, and will print newlines in strings accordingly.For cases where this is not desired (such as printing a newline character in the indentation-aware newline logic),
print_string_raw
has been added to print the string ignoring indentation.Additionally, a helper
indented
function for with statements has been added to control indentation within a scope. Feedback on this would be much appreciated, as a possible concern is that it may not be super intuitive (it indents newlines, not lines).