在VS代码中创建摘要时,如何更改TM_FILENAME_BASE?
我有一个名为的文件“ card.styled.js”
我想创建一个摘要来编写更轻松的样式组件:
"styled": {
"prefix": "styled",
"body": [
"import styled from \"styled-components\"",
"",
"export const ${1:${TM_FILENAME_BASE}} = styled.$2`",
"",
"${3}",
"`"
]
}
但是$ {1:$ {$ {TM_FILENAME_BASE}}}
是返回我card.Styled
。
在这种情况下,我只想返回card
。
I have a file named "Card.styled.js"
I want to create a snippet to write easier the styled component:
"styled": {
"prefix": "styled",
"body": [
"import styled from \"styled-components\"",
"",
"export const ${1:${TM_FILENAME_BASE}} = styled.$2`",
"",
"${3}",
"`"
]
}
But ${1:${TM_FILENAME_BASE}}
is returning me Card.styled
.
I want to return only Card
in this case.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
card.Styled
是card.styled.js
的正确TM_FILENAME_BASE
。您将不得不进一步修改它。您想要这样的东西:
(。*?)\\ ..*
在第一个。
中获取所有内容,进入捕获组1匹配整个FILENAME_BASE,并仅用捕获替换它第1组。
Card.styled
is the correctTM_FILENAME_BASE
ofCard.styled.js
. You will have to modify it further.You want something like this:
(.*?)\\..*
get everything before the first.
into capture group 1Match the entire filename_base and replace it with only capture group 1 .