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

ScalaDoc's with backtick-ed text gets reformatted with 3.8.4 #4716

Closed
mr-git opened this issue Jan 14, 2025 · 2 comments · Fixed by #4721
Closed

ScalaDoc's with backtick-ed text gets reformatted with 3.8.4 #4716

mr-git opened this issue Jan 14, 2025 · 2 comments · Fixed by #4721

Comments

@mr-git
Copy link

mr-git commented Jan 14, 2025

Required: Configuration

version = 3.8.4
project.git = true
runner.dialect = Scala3
fileOverride {
  "glob:**/*.sbt" { runner.dialect = sbt1 }
}

Steps

Given code like this:

/** Code `block`'s possession gets spaced away. Similar reformatting happens with plural `block`s. */

Problem

Scalafmt formats code like this (extra space added after block's closing backticks):

/** Code `block` 's possession gets spaced away. Similar reformatting happens with plural `block` s. */

Expectation

I would like the formatted output to look like this:

/** Code `block`'s possession gets spaced away. Similar reformatting happens with plural `block`s. */

Workaround

I failed to find workaround or config, which would not reformat possession in-lined blocks of code, except not upgrading.

Notes

Same unexpected reformatting of ScalaDocs happens with runner.dialect = Scala213Source3 in Scala 2.13 projects.

@mjhoy
Copy link

mjhoy commented Jan 14, 2025

We ran into this as well; hoping this was unintentional because it introduces unwanted whitespace.

@ekrich
Copy link

ekrich commented Jan 15, 2025

Yes, this is what I see as well - it did find a missing backtick and places I needed spaces but it is better to avoid scalafmt getting involved in these documentation issues. https://github.com/ekrich/sconfig/pull/416/files

mzuehlke added a commit to mzuehlke/cats-effect that referenced this issue Jan 20, 2025
Scalafmt 3.8.4 introduced some formatting bugs that are reverted with this pull request.

Issue in Scalafmt:
- scalameta/scalafmt#4716

Bad formatting got merged to cats-effect in:
- typelevel#4235
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 a pull request may close this issue.

3 participants