[英]Visual Studio Code and emmet !important CSS modifier
I have problems with the use of !
我在使用时遇到问题!
in my CSS code.在我的 CSS 代码中。
If I take the example in the Emmet documentation :如果我以 Emmet 文档中的示例为例:
p!+m10e!
Should produce:应该产生:
padding: !important;
margin: 10em !important;
On my side, it doesn't work.在我这边,它不起作用。 p!+m10e
works, but p!+m10e!
p!+m10e
有效,但是p!+m10e!
does not.才不是。 The final exclamation point seems to be a problem.最后一个感叹号好像有问题。
I did another test with dn!
我用dn!
做了另一个测试dn!
to display display: none !important;
显示display: none !important;
, the problem is the same. ,问题是一样的。
Do you have an idea?你有想法吗?
The solution lies in disabling text-suggestions
.解决方案在于禁用text-suggestions
。 In fact, I think the fact that IntelliSense shows the !important
and !default
when you type an exclamation mark, makes Emmet mess up.事实上,我认为 IntelliSense 在您键入感叹号时显示!important
和!default
的事实让 Emmet 搞砸了。
So I disabled this:所以我禁用了这个:
"editor.suggest.showWords": false
If you prefer the UI, you can also find it by doing the following:如果您更喜欢 UI,也可以通过执行以下操作来找到它:
Navigate the menus: click on - File > Preferences > Settings (or press Ctrl + ,)导航菜单:单击 - 文件 > 首选项 > 设置(或按 Ctrl + ,)
Type Show Words in the search box at the top在顶部的搜索框中键入 Show Words
Uncheck the setting Editor > Suggest: Show Words取消选中设置 Editor > Suggest: Show Words
A few observations, this may help future readers:一些观察,这可能对未来的读者有所帮助:
CTRL + Space
forces the non-suggested(intellisense) expansion. CTRL + Space
强制非建议(智能感知)扩展。
"emmet.triggerExpansionOnTab": true
also expands non-suggested option. "emmet.triggerExpansionOnTab": true
也扩展非建议选项。
If you type dn!i
it will give you suggestion dn: i !important;
如果你输入dn!i
它会给你建议dn: i !important;
then you delete 'i' then hit enter/tab, it expands as expected.然后你删除 'i' 然后按 Enter/tab,它会按预期扩展。
I think the bug https://github.com/microsoft/vscode/issues/120245 still hasn't been resolved completely.我认为错误https://github.com/microsoft/vscode/issues/120245仍然没有完全解决。 Otherwise you could've typed 'dn!important` and it would've expanded as expected.否则,您可以输入“dn!important”,它会按预期扩展。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.