控制 VS Code 代码片段的制表位顺序
Control the tab stop order for code snippet of VS Code
例如,使用以下代码,当我键入 "im" 和 Tab 键时,我将得到 "import { } from ''",并且初始焦点将位于 $2 位置,而不是 $1 位置。我怎样才能将初始焦点定在 1 美元?谢谢
{
"import": {
"prefix": "im",
"body": [
"import { } from ''"
],
"description": "import element from a module"
}
}
不确定为什么它不遵循制表位顺序,也许是 bug?
解决方法可能是将 $0 显式设置为制表位的结尾
"import": {
"prefix": "im",
"body": [
"import { [=10=] } from ''"
],
"description": "import element from a module"
}
vscode Docs:
The snippet syntax follows the TextMate snippet syntax with the
exception of 'regular expression replacements', 'interpolated shell
code' and 'transformations', which are not supported.
TextMate 片段语法 Manual:
The caret will start at , then when pressing tab it will move to
and on next tab etc. until there are no more tab stops. If you do
not explicitly set [=12=], the caret will be at the end of the snippet.
例如,使用以下代码,当我键入 "im" 和 Tab 键时,我将得到 "import { } from ''",并且初始焦点将位于 $2 位置,而不是 $1 位置。我怎样才能将初始焦点定在 1 美元?谢谢
{
"import": {
"prefix": "im",
"body": [
"import { } from ''"
],
"description": "import element from a module"
}
}
不确定为什么它不遵循制表位顺序,也许是 bug? 解决方法可能是将 $0 显式设置为制表位的结尾
"import": {
"prefix": "im",
"body": [
"import { [=10=] } from ''"
],
"description": "import element from a module"
}
vscode Docs:
The snippet syntax follows the TextMate snippet syntax with the exception of 'regular expression replacements', 'interpolated shell code' and 'transformations', which are not supported.
TextMate 片段语法 Manual:
The caret will start at , then when pressing tab it will move to and on next tab etc. until there are no more tab stops. If you do not explicitly set [=12=], the caret will be at the end of the snippet.