feat: fields and message expansion feature
Description
This pull request adds the ability to expand fields and messages.
-x, --expansion <MODE> Whether to expand fields and messages [env: HL_EXPANSION=] [default: medium] [possible values: never, inline, low, medium, high, always]
- Expansion mode
nevercompletely disables field expansion, even if multiline fields are found. - Expansion mode
inlineexpands only multi-line fields as-is (inline) without any prefixes or formatting. - Expansion mode
lowuseslowexpansion settings profile, which minimizes expansion. - Expansion mode
mediumusesmediumexpansion settings profile, which provides an optimal balance between readability and density. - Expansion mode
highuseshighexpansion settings profile, which shifts the balance towards readability. - Expansion mode
alwaysexpands every field regardless of its value and expands the message if it is multiline.
The default mode is now medium. To keep the old behavior, use the inline mode.
Demo
Codecov Report
:x: Patch coverage is 96.59864% with 30 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 83.37%. Comparing base (c056f7a) to head (5e62dee).
:warning: Report is 366 commits behind head on master.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/app.rs | 94.62% | 17 Missing :warning: |
| src/cli.rs | 93.20% | 7 Missing :warning: |
| crate/mline/src/lib.rs | 99.28% | 2 Missing :warning: |
| src/model.rs | 90.47% | 2 Missing :warning: |
| src/fmtx.rs | 90.90% | 1 Missing :warning: |
| src/settings.rs | 97.56% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #320 +/- ##
==========================================
+ Coverage 80.59% 83.37% +2.78%
==========================================
Files 41 42 +1
Lines 12028 13854 +1826
==========================================
+ Hits 9694 11551 +1857
+ Misses 2334 2303 -31
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
This feature looks incredible! Is there any ETA on it landing?
Keep up the great work.
@zx8 Thanks! There is no ETA on this yet. I thought this feature was almost ready, but it turned out to be more complex than I initially expected, and some of the decisions made here are quite controversial. There are unneeded complications in the codebase, as well as new, subtle bugs. I decided to postpone it a bit because I hope to finish another huge refactoring soon. That will help make the implementation of this feature less messy. I will probably split this feature into two parts. I am also thinking about delivering less heuristic-based code in the first batch, since it is the most controversial and complicated to implement, and it requires a lot of advanced configuration for fine-tuning.