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

[Scala 3] Fix indentation in generated code #566

Merged
merged 1 commit into from
Oct 5, 2021

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Oct 4, 2021

Previously, we would not add an additional nesting for expressions with generated defintion, which could cause the binder statement to be included in the evaluated statement.

Now, we correctly indent after = for generated definitions.

Fixes #565

@tgodzik tgodzik requested a review from keynmol October 4, 2021 19:04
@@ -51,6 +51,24 @@ class WorksheetSuite extends BaseSuite {
|""".stripMargin
)

checkDecorations(
Copy link
Collaborator

Choose a reason for hiding this comment

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

As this is not just a worksheet issue (it can be reproduced by vanilla mdoc), would you mind adding a test to the regular suites?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the test case to DefaultSuite.scala, seems to work alright.

body.linesIterator.toArray.foreach(this.println)
if(nest) nestCount -= 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

For my own mental note - will need to keep that in mind when doing #498, to make sure that generated definition is wrapped in {} on scala 2, as indentation alone won't cut it.

Previously, we would not add an additional nesting for expressions with generated defintion, which could cause the binder statement to be included in the evaluated statement.

Now, we correctly indent after `=` for generated definitions.

Fixes scalameta#565
@tgodzik tgodzik merged commit a897826 into scalameta:main Oct 5, 2021
@tgodzik tgodzik deleted the fix-indentation branch October 5, 2021 12:02
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.

Unable to handle postfixOps in Scala 3
2 participants