新增支持${0:pass} 这样的标准代码片段(Snippet)语法 #4
+65
−22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
新增了支持Vscode里标准的Snippet语法的实现
我们以python里的for循环为例
新增的效果即可以识别
${0:pass}
这种语法即${序号:varilable}
,我们将前面的数字定义为Tabstop,下面列出常见的Tabstop编号${0:content}
- 最终光标位置这是Tabstop序列的结束位置
当用户按Tab键跳过所有占位符后,光标会停留在这个位置
${1:content}
- 第一个可编辑占位符用户第一次按Tab键会跳转到这里
可以有多个相同编号的占位符,它们会同时编辑
${2:content}
- 第二个可编辑占位符用户第二次按Tab键会跳转到这里
实际编写代码的效果



如图所示,pass会被选中然后用户输入会自动删掉