0

I'm using VSCode and working with CSS/scss files. I use Prettier to format my code on save, but there is one thing I would like not to format. Avoiding multiple selectors for a declaration to be formatted on 1 line each.

I would like to keep my selectors on one line or as they were write like this:

.dropdown-item:active, .nav-item a.nav-link, h1, h2, h3, h4, h5, .pagination a {
  text-decoration: none;
}

but with Prettier > Format on save, I've got this:

.dropdown-item:active,
.nav-item a.nav-link,
h1,
h2,
h3,
h4,
h5,
.pagination a {
  text-decoration: none;
}

Ok I know, me too I prefer the 2nd formatting, but I'm working with a staff that code the first way. And when I want to make a git commit, I've got plenty of changes obviously that my staff doesn't want.

Is there any property I can write in my settings.json or somewhere else?

I try to find on Prettier a way to do this, but couldn't find anything except "prettier.singleAttributePerLine" : false, which is not what I request.

my settings.json

"editor.formatOnSave": true,
"[html]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[css]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[scss]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },

Thanks from France

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
echayotte
  • 1
  • 3

0 Answers0