admin管理员组文章数量:1122846
I have a Vue project in PhpStorm and every time I want to import or use curly braces in Vue component, I'm having to add extra spaces inside my curly braces.
When I type import {
, the closing curly brace is added in, so I end up with this:
If I press space once, I have of course:
What I would like, as soon as I press the space, that
the IDE automatically inserts another space and moves caret one position to left, so end up with {[space][caret][space]}
. And similarly, {{[space][caret][space]}}
for double curly braces (used in Vue components).
I've tried with Live Templates (as mentioned here) but it doesn't seem to trigger after typing {
... (I've tried selecting 'None' and 'Tab' as expand but doesn't work).
It seems that a space is not allowed in the 'abbreviation' (when I Apply it and reopen this setting, the space is gone):
I have a Vue project in PhpStorm and every time I want to import or use curly braces in Vue component, I'm having to add extra spaces inside my curly braces.
When I type import {
, the closing curly brace is added in, so I end up with this:
If I press space once, I have of course:
What I would like, as soon as I press the space, that
the IDE automatically inserts another space and moves caret one position to left, so end up with {[space][caret][space]}
. And similarly, {{[space][caret][space]}}
for double curly braces (used in Vue components).
I've tried with Live Templates (as mentioned here) but it doesn't seem to trigger after typing {
... (I've tried selecting 'None' and 'Tab' as expand but doesn't work).
It seems that a space is not allowed in the 'abbreviation' (when I Apply it and reopen this setting, the space is gone):
Share Improve this question edited Nov 21, 2024 at 18:15 LazyOne 165k47 gold badges412 silver badges415 bronze badges asked Nov 21, 2024 at 13:41 gvantogvanto 2,0743 gold badges24 silver badges27 bronze badges 8 | Show 3 more comments1 Answer
Reset to default 0Many thanks @lazyone! The below works well:
本文标签: javascriptHow to get spacecaretspace and spacecaretspaceStack Overflow
版权声明:本文标题:javascript - How to get {[space][caret][space]} and {{[space][caret][space]}} - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736310369a1934352.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
Settings/Preferences | Editor | Code Style | TypeScript | Spaces | Within | ES6 import/export braces
2) For{{ | }}
-- can you check the available Code Styles for Vue --Settings/Preferences | Editor | Code Style | Vue template | Spaces | Within | Interpolations
. P.S. At very least they should work on code reformat (in Blade/Twig the spaces are added on typing AFAIK). – LazyOne Commented Nov 21, 2024 at 18:13{
in the abbreviation. It's just{
alone. So you just type{
and press[TAB]
(your expand key) and it should do that. – LazyOne Commented Nov 21, 2024 at 18:16{
as abbreviation and selectSpace
as an expand key for that specific Live Template .. but that will be unwise (as it most likely will cause issues when you will be using the brace elsewhere, where you do not wish to have this behaviour). But try it anyway -- might work in your workflow. – LazyOne Commented Nov 22, 2024 at 9:50Tab
in the default (and most often used) expand key. – LazyOne Commented Nov 22, 2024 at 9:52