feat: experimental doc comment formatting#420
Draft
QuadnucYard wants to merge 2 commits intotypstyle-rs:masterfrom
Draft
feat: experimental doc comment formatting#420QuadnucYard wants to merge 2 commits intotypstyle-rs:masterfrom
QuadnucYard wants to merge 2 commits intotypstyle-rs:masterfrom
Conversation
📊 Benchmark Performance Reportgroup base pr
----- ---- --
pretty-ai-comprehensive-showcase 1.00 900.5±9.77µs ? ?/sec 1.02 916.9±9.70µs ? ?/sec
pretty-cetz-manual 1.01 758.7±28.30µs ? ?/sec 1.00 754.9±11.32µs ? ?/sec
pretty-codly 1.00 1789.9±21.58µs ? ?/sec 1.02 1819.1±25.32µs ? ?/sec
pretty-cpe 1.59 19.2±3.91ms ? ?/sec 1.00 12.1±0.11ms ? ?/sec
pretty-deep-nested-args 1.02 18.3±0.12µs ? ?/sec 1.00 18.0±0.22µs ? ?/sec
pretty-fletcher-diagram 1.00 520.7±9.77µs ? ?/sec 1.02 533.2±9.94µs ? ?/sec
pretty-fletcher-draw 1.00 1258.1±10.88µs ? ?/sec 1.02 1287.8±11.30µs ? ?/sec
pretty-tablex 1.00 3.4±0.02ms ? ?/sec 1.02 3.5±0.02ms ? ?/sec
pretty-touying-core 1.00 2.2±0.02ms ? ?/sec 1.01 2.2±0.01ms ? ?/sec
pretty-touying-utils 1.00 1209.1±17.18µs ? ?/sec 1.02 1232.1±23.36µs ? ?/sec
pretty-undergraduate-math 1.00 868.6±17.34µs ? ?/sec 1.00 868.0±12.09µs ? ?/sec📏 Binary Size Comparison
📦 Detailed Crate Size Diff (cargo-bloat)Note: Numbers above are a result of guesswork. They are not 100% correct and never will be. @@ -1,20 +1,20 @@
-std 397.8 kB
-clap_builder 338.9 kB
-typstyle_core 203.0 kB
-typst_syntax 140.9 kB
+std 397.2 kB
+clap_builder 340.3 kB
+typstyle_core 208.7 kB
+typst_syntax 141.1 kB
clap_complete 131.2 kB
-typstyle 55.3 kB
-similar 34.3 kB
+typstyle 60.8 kB
+similar 33.3 kB
walkdir 19.7 kB
-toml_edit 9.1 kB
+toml_edit 9.9 kB
colored 9.0 kB
-anyhow 8.5 kB
-prettyless 7.3 kB
+prettyless 8.9 kB
+anyhow 8.6 kB
clap_lex 4.2 kB
path_absolutize 4.2 kB
hashbrown 4.1 kB
parking_lot 2.6 kB
-anstream 2.5 kB
+anstream 2.6 kB
ecow 2.4 kB
anstyle 2.4 kB
parking_lot_core 2.2 kBGenerated by GitHub Actions on 2025-08-07 12:29:24 UTC |
Collaborator
Author
|
found a problem with text-wrapping: |
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Doc comments (
/// comment), although not admitted by the official, are already widely used in existing projects.This PR introduces basic support for doc comment formatting.
We create a sub-formatter for doc comments, which inherits the config of its parent.
wrap_doc_commentsis set totrue, the inner config also setswrap_texttotrue.max_widthuses parentaldoc_comment_width.Since we do not have a prefix element in the format engine, currently we have to print the contents of doc comments into strings, and then place them back to the document.
Changes
Checklist
Before submitting, please ensure you've done the following:
Testing
Additional Notes