Visual Studio 中的自定义格式文档选项。设置 CSS 标签格式
当我在 VS2008 中工作时,我经常使用 Ctrl+K+D,因为它节省了大量时间。
但在 CSS 文件中,此命令以我不太喜欢的方式格式化文档。
例如,当我自动格式化文档时,
.Foo
{
width:1px;
height:2px;
}
但是,我喜欢以这种方式格式化标签,因为它更容易阅读(在我看来):
.Foo
{ width:1px;
height:2px; }
那么,有什么方法可以实现这个吗?
“标签特定选项”功能似乎是我需要的,但我不太确定如何做到这一点。
谢谢。
When i work in VS2008, i use the Ctrl+K+D very often as it saves a lot of time.
But in CSS files, this command formats the document in a way i don't quite like.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我刚刚查看了 Visual Studio 代码格式化选项,似乎只有三个选项可供选择:
这些都不满足您的要求。 C#(和其他语言)的格式设置选项更加可定制。
I just looked in the Visual Studio code formatting options and it appears that there are only three options you can choose from:
None of these meet your requirements. The formatting options for C# (and other languages) are much more customizable.
好吧,过了很长一段时间我想出了一个可以接受的解决方案;
将您的 css 复制(或上传)到此网站,然后在右侧选择“高(中等可读性,较小尺寸)” ”
,它将把你的 css 变成
(
在我的例子中,这就是我想要的,你可以选择你最喜欢的,有五个预设和其他附加选择。)
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)"
and it will turn your css
into
(in my case, thats the one i wanted, you can select what you like most, there are five presets and other additional choices.)