Skip to content
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

Preserve indentation inside codeblocks #3084

Merged
merged 1 commit into from
Jan 28, 2022

Conversation

dos65
Copy link
Member

@dos65 dos65 commented Jan 27, 2022

Previsoly in some cases there were additional unwated spaces inside code
lines.

@@ -3218,3 +3218,33 @@ object a {
*/
val a = 1
}
<<< preserve indentation in code blocks
docstrings.style = Asterisk
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to do this for all styles, otherwise it's not fully tested. AsteriskSpace is the tricky one. i would also recommend switching styles; that is, write the original in, say, SpaceAsterisk but ask to reformat as AsteriskSpace. and make sure it still works and doesn't lead to non-idempotence.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point.
added

offsetOpt match {
case Some(offset) =>
val extra = math.max(0, offset - leadingMargin)
sb.append(getIndentation((extra >> 1) << 1))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this part may not have been ideal but it dealt with style switching.

Previsoly in some cases there were additional unwated spaces inside code
lines.

Co-authored-by: Albert Meltzer <7529386+kitbellew@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants