简体   繁体   中英

how to set commas in prettier vs code

I have css file. I want to set prettier vs code so that after writing a comma, the selector I wrote remained in line with the previous selector. But when i save the file, the selector will be entered to next line

I want to save the code like this (my expectation)

在此处输入图像描述

But prettier set the code like this (h3 entered to next line) 在此处输入图像描述

How to fix this problem? I set trailling comma to none but it doesn't work. 在此处输入图像描述

I think that config you changed only applies to JavaScript files (notice the reference to ES5).

As far as CSS, prettier is opinionated and they decided that each selector should have its own line ( this PR implements that behaviour ). I don't think there's a config to change that behaviour.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM