Feature Request: Native support ${num:$Snippet(prefix)} to nest other code snippets & trigger snippets inside quotes/brackets

Open
#323,388 1 comment 0 reactions 1 assignee View on GitHub

@alexdima is already working on this.

Since Jun 29, 2026.

Assessment

This issue has not been assessed yet.

Description

ai-translated
现有问题
  1. VS Code原生snippet不支持内嵌其他片段,网上$Snippet()语法仅第三方插件可用,换环境插件失效
  2. 光标在单/双引号、圆括号内部时,无法检索、触发code-snippets代码片段,复用片段很麻烦
期望新增功能
  1. 原生支持 ${1:$Snippet(片段prefix)} 语法,自动加载对应prefix的片段并继承下拉占位符
  2. 增加设置开关:允许在字符串引号、括号内部检索、触发代码片段
  3. 支持多段占位符独立跳转,不共享同编号同步编辑冲突
使用场景(我的PowerMill宏开发场景)

我大量复用「元素」下拉片段,在pathname函数参数引号内需要反复输入前缀手动Tab切换,原生不支持嵌套,代码冗余严重。
示例片段:
{
"元素路径": {
"prefix": "pathname = 取激活元素路径",
"body": [
"pathname('${1:$Snippet(元素)}','${2:$Snippet(元素)}'.name)"
]
},
"元素": {
"prefix": "元素",
"body": ["${1|toolpath,tool,Boundary,Pattern|}"]
}
}

替代方案现状

只能拆分占位符到引号外,或安装第三方插件,兼容性差,团队共享片段会出现大量失效。

Dominant language
TypeScript
Stars
193k
Forks
42.9k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/vscode

All issues in microsoft/vscode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.