Conversation
src/documentation/literal.rs
Outdated
|
|
||
| #[derive(Clone, Hash, PartialEq)] | ||
| pub enum Padding { | ||
| Padding(String), |
There was a problem hiding this comment.
If we only have one content variant here, we might want to limit it to AsteriskSpace{ leading_spaces: usize }
There was a problem hiding this comment.
That makes sense, thanks! To make sure I'm understanding, for the string " * ", it would be AsteriskSpace with 1 for leading_spaces or 3 to account for the whole string?
There was a problem hiding this comment.
I was thinking of the two variants: Doc and NonDoc, the first might be a single span for now and hence contain all leading spaces as well.
There was a problem hiding this comment.
Would this be a separate enum or replace the current one? I updated the current enum to reflect your comments and the more specific variant
There was a problem hiding this comment.
That was misleading, sorry about that. I think we can represent both with the enum Padding with the Asterisk* variant.
|
Thanks for the feedback on this! I updated the branch with your comments, should this be incorporated into the |
I think, removing it at the span/syn/ra_ap_syntax stage will simplify later stages significantly (or: avoid additional code changes), so I'd recommend having a clean Note: There is a caveat that a few consecutive |
|
Great, thanks! Should this be in or before the Also, I think we'll need to bump the version of |
Whereever you see fit :) Bump deps as needed. |
|
I made some updates to reflect the recent feedback but it looks like I'm a bit stuck again. Should |
| trimmed_multi_doc, | ||
| "/** | ||
| mood | ||
| * mood |
There was a problem hiding this comment.
I think both variants should work, the * should be optional.
| let content = "/**\n doc\n doc\n */".to_string(); | ||
| assert_matches!( | ||
| detect_and_remove_padding(&content), | ||
| (CommentPaddingStyle::NoPadding, content) | ||
| ); |
There was a problem hiding this comment.
I'd prefer smaller test cases, even if this has a compile time cost to it.
And I think we need a few more to cover the indented variants, as in multiple leading spaces before the asterisk.
| assert_matches!( | ||
| detect_and_remove_padding(&content), | ||
| (CommentPaddingStyle::NoPadding, content) |
| lazy_static! { | ||
| static ref PADDING_STR: Regex = | ||
| Regex::new(r##"(?m)^\s\*\s"##).expect("PADDING_STR regex compiles"); | ||
| }; |
There was a problem hiding this comment.
#202 introduced an optimization to avoid the regex entirely and use smid instructions as available, probably worth to hand roll this, but that can be done once you're confident of the structure - this is works and is good for the time being 👍
268ad24 to
03b0d5a
Compare
I think you have two options: Either replace
Just explaining this to you makes it clear that there is a lot of documentation missing and quite a few design joices are not obvious, and naming of things could be improved by quite a bit. Very much appreciate your effort! @pjsier let me know if there is anything else I can do to aid you driving this to completion :) |
|
@pjsier gentle ping :) |
|
@drahnr thanks for following up on this! I haven't had as much time as I would have liked, so if I'm holding anything up feel free to take over and thanks for all the input |
I think it's better if you push it over the finish line :) there is no particular rush here - take your time! |
What does this PR accomplish?
Closes #133.
Changes proposed by this PR:
Detect padding in doc comments with
CommentPaddingStyleenumNotes to reviewer:
Adds enum and
detect_paddingmethod to parse and store padding style📜 Checklist
./demosub directory