Skip to content

SCSS: Fix broken comments between declaration prop and value#8366

Merged
lipis merged 9 commits intoprettier:masterfrom
fisker:issue-5603
Jun 9, 2020
Merged

SCSS: Fix broken comments between declaration prop and value#8366
lipis merged 9 commits intoprettier:masterfrom
fisker:issue-5603

Conversation

@fisker
Copy link
Copy Markdown
Member

@fisker fisker commented May 21, 2020

Fixes #5603
Fixes #8052
Fixes #7109

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory)
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/pr-XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@fisker fisker marked this pull request as ready for review May 27, 2020 18:04
@fisker
Copy link
Copy Markdown
Member Author

fisker commented May 27, 2020

I forgot mark this ready, this not prefect, but prints better.

# Conflicts:
#	tests/less/comments/__snapshots__/jsfmt.spec.js.snap
Comment on lines +215 to +226
$font-family-rich:
// custom
"Noto Sans TC", "Noto Sans SC", "Noto Sans JP",
// Safari for OS X and iOS (San Francisco)
-apple-system,
BlinkMacSystemFont,
// fallback
Roboto,
"Helvetica Neue", Helvetica, Arial, sans-serif,
// emoji
"Apple Color Emoji",
"Segoe UI Emoji", "Segoe UI Symbol" !default;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I know this still ugly, but stable even worse

Prettier 2.0.5
Playground link

--parser scss

Input:

$font-family-rich:
  // custom
  'Noto Sans TC', 'Noto Sans SC', 'Noto Sans JP', 
  // Safari for OS X and iOS (San Francisco)
  -apple-system, BlinkMacSystemFont,
  // fallback
  Roboto, 'Helvetica Neue', Helvetica, Arial, sans-serif,
  // emoji
  'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol' !default;

Output:

$font-family-rich:
  // custom "Noto Sans TC", "Noto Sans SC", "Noto Sans JP",
  // Safari for OS X and iOS (San Francisco)
    -apple-system,
  BlinkMacSystemFont,
  // fallback
    Roboto,
  "Helvetica Neue", Helvetica, Arial, sans-serif,
  // emoji
    "Apple Color Emoji",
  "Segoe UI Emoji", "Segoe UI Symbol" !default;

Copy link
Copy Markdown
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Not too bad

@alexander-akait
Copy link
Copy Markdown
Member

We can improve it in the future, broken code is worse than ugly

@fisker
Copy link
Copy Markdown
Member Author

fisker commented May 27, 2020

Forgot changlog, will add tomorrow.

@lipis lipis merged commit 3e44061 into prettier:master Jun 9, 2020
@fisker fisker deleted the issue-5603 branch June 9, 2020 16:17
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SCSS] rule gets accidentally commented out Broken SCSS Comment Fixing SCSS single-line comments are formatted incorrectly

3 participants