英文:
CSS auto-complete curly braces
问题
在CSS文件中,按下{
键后,是否可以自动添加大括号并将规则集主体移到自己的空行上(自动完成)?我找不到任何相关信息。我觉得很奇怪它不存在,当我谷歌搜索时也没有找到答案...
VS Code可以做到这一点:
.auto_curly_braces{}
而我希望的是:(光标位于选择器下方)
.auto_curly_braces {
}
英文:
Is it possible to add curly braces and open up the ruleset body to its own empty line automatically (autocomplete) in CSS file after pressing <kbd>{</kbd>? I can't find any info on that. I find it surprising that it doesn't exist, didn' find any answer when I google it...
VS Code does this:
.auto_curly_braces{}
And I'm looking for this: (with cursor under the selector)
.auto_curly_braces {
}
答案1
得分: 0
无。VS Code会自动添加闭合大括号,但不会自动创建规则集主体内的声明的新行。
但要实现这个功能,只需在键入 {
后按下 enter
。
据我所知,目前不可配置跳过按 enter
键以达到这种文本状态。而且并不是普遍、客观地接受总是将每个CSS声明放在自己的一行中(尤其当规则集中只有一个声明时),这可能是部分原因。
英文:
> Is it possible to add curly braces and open up the ruleset body to its own empty line automatically (autocomplete) in CSS file after pressing <kbd>{</kbd>?
No. VS Code will automatically add the closing curly brace, but it will not automatically create a new line for declarations inside the rulset's body.
But all you need to do to get that is to press <kbd>enter</kbd> after typing <kbd>{</kbd>.
As far as I know, it is not configurable to skip pressing <kbd>enter</kbd> to get to that text state. And it's not universally, objectively accepted as a good thing to always have each CSS declaration in its own line (especially when there's only one declaration in the ruleset), which is probably part of the reason why.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论