简体   繁体   中英

How to prevent Visual Studio 2019 from formatting CSS as multi-line on paste?

I like to format my CSS as a single line per selector. When I'm hand-coding, that's easy enough in VS 2019. But, as soon as I paste something it expands the following attributes onto 1 line per attribute. I know I can use Ctrl + z to get it back to one line, but I'd prefer it didn't expand when pasting at all. I'm constantly fighting the autoformatting. Is it possible to turn this off? I've played with all of the options settings I can think of. Does anyone know how to turn off the autoformatting when pasting CSS in VS 2019?

Yes, you can do this by going to the Tools menu and selecting Options .

In the Options window, go to Text Editor > CSS > Advanced and set "Format on paste" to Off :

CSS 高级部分的 VS 选项窗口

Here is an animated gif showing that changing this setting solves this problem:

在此处输入图像描述

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