-
Notifications
You must be signed in to change notification settings - Fork 694
fix(doc): properly handle indentation in multi-line doc comments #8835
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
base: main
Are you sure you want to change the base?
fix(doc): properly handle indentation in multi-line doc comments #8835
Conversation
orizi
left a comment
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.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @CreeptoGengar)
a discussion (no related file):
would suggest adding a test to show the improvement.
|
Added a test case for the indentation fix. |
orizi
left a comment
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.
@orizi reviewed all commit messages.
Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @CreeptoGengar and @FroyaTheHen)
a discussion (no related file):
@FroyaTheHen
FroyaTheHen
left a comment
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.
Reviewable status: 0 of 3 files reviewed, 3 unresolved discussions (waiting on @CreeptoGengar and @orizi)
crates/cairo-lang-doc/src/tests/test-data/indentation.txt line 1 at r2 (raw file):
//! > Documentation
Can you please add a test case that would have failed before but now passes?
crates/cairo-lang-doc/src/tests/test-data/indentation.txt line 43 at r2 (raw file):
This line has extra indentation. This line has less indentation. Another indented line.
I understand that the behaviour expected from those changes would be to preserve the indentation in a way that would remove the number of leading whitespaces common to all the comment lines. (Please argue otherwise if you do not agree.) Although the test shows all of the leading whitespaces are removed. Isn't the expected 👇 ??
Suggestion:
//! > Item documentation #2
Function with multi-line doc comment.
This line has extra indentation.
This line has less indentation.
Another indented line.
Fix incorrect indentation handling in documentation comment extraction.
The previous implementation only removed a single space after comment markers, which caused issues with multi-line comments having varying indentation levels.
Now the code finds the minimum common indentation across all lines in a comment block and removes it uniformly, preserving
relative alignment within the block.