有没有办法如何强制Visual Studio Web Essentials插入单引号而不是双引号?
例如,div.col-xs-1
TAB生产<div class='col-xs-1'></div>
而不是默认的<div class="col-xs-1"></div>
?
我正在使用Visual Studio 2013 Update 4和Web Essentials 2013 v.2.5.3。
最近不是约翰尼,但是我无法在VS代码中使用它,所以我想我会为仍有这个问题的人发布一个解决方案。我的解决方案是进入设置(ctrl-,)>用户设置>扩展> emmet,然后在首选项下单击“在settings.json中编辑”。在那里,我将其添加到用户设置:
"emmet.syntaxProfiles": {
"xml": {
"attr_quotes": "single"
},
"html": {
"attr_quotes": "single"
},
"js": {
"attr_quotes": "single",
"self_closing_tag": true
},
"jsx": {
"attr_quotes": "single",
"self_closing_tag": true
}
}
您可以为每种语言定义设置。这对我有用。
要获得使用JSX的单引号,您需要使用语法配置文件在syntaxProfiles.json
中更新或创建~/emmet
。如果~/emmet
不存在则创建它。
关键是文件扩展名,值是扩展程序将使用的配置文件的名称。
所以在~/emmet/syntaxProfiles.json
/* 'js' will map files with .js extension to use the js profile*/
/* 'jsx' will map files with .jsx extension to also use the js profile*/
{
"js": "js",
"jsx": "js"
}
在~/emmet/profiles.json
/* create or add the 'js' profile */
{
"html": {
"attr_quotes": "double"
},
"js": {
"attr_quotes": "single",
"self_closing_tag": true
}
}
这适用于大多数编辑,但我只尝试过原子。 https://github.com/emmetio/emmet-atom/issues/68