[英]Custom format document option in visual studio. Formatting CSS tags
When i work in VS2008, i use the Ctrl+K+D very often as it saves a lot of time. 当我在VS2008中工作时,我经常使用Ctrl + K + D,因为它节省了大量时间。
But in CSS files, this command formats the document in a way i don't quite like. 但是在CSS文件中,此命令以我不太喜欢的方式格式化文档。
For example when i auto format the document, 例如,当我自动格式化文档时,
.Foo
{
width:1px;
height:2px;
}
However, i like to format tags this way, as it is much more easy to read (in my opinion): 但是,我喜欢以这种方式格式化标签,因为它更容易阅读(在我看来):
.Foo
{ width:1px;
height:2px; }
So, are there any way that i can implement this ? 那么,有什么方法可以实现这个吗?
The "Tag specific options" feature seems to be the thing that i need, but i am not quite sure how to do this. “标签特定选项”功能似乎是我需要的东西,但我不太确定如何做到这一点。
Thanks. 谢谢。
I just looked in the Visual Studio code formatting options and it appears that there are only three options you can choose from: 我只是查看了Visual Studio代码格式化选项,看起来只有三个选项可供您选择:
None of these meet your requirements. 这些都不符合您的要求。 The formatting options for C# (and other languages) are much more customizable. C#(和其他语言)的格式化选项更加可定制。
OK, after a long while i came up with an acceptable solution; 好吧,很长一段时间后我想出了一个可以接受的解决方案;
copy your css (or upload) to this site and at right, select "High (moderate readability, smaller size)" 将您的CSS(或上传)复制到此站点 ,然后选择“高(可读性适中,尺寸较小)”
and it will turn your css 它会变成你的CSS
.foo
{
font-weight: bold;
color: #ff0000;
}
into 成
.foo { font-weight: bold; color: #ff0000; }
(in my case, thats the one i wanted, you can select what you like most, there are five presets and other additional choices.) (就我而言,那就是我想要的那个,你可以选择你最喜欢的,有五个预设和其他额外的选择。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.