如何在注释和字符串中使用片段

ydh*_*hat 5 code-snippets visual-studio-code

在 Visual Studio Code 中,片段在注释或字符串中不起作用。例如,我为“test”创建片段“t”,然后在注释中输入“t”,如下所示

# t
Run Code Online (Sandbox Code Playgroud)

或者像字符串一样

"this is a string t"
Run Code Online (Sandbox Code Playgroud)

然后没有任何建议,按“tab”不起作用。

如何在 Visual Studio 代码中使用注释和字符串中的片段?

ydh*_*hat 6

在 中User Setting,输入以下内容:

"editor.quickSuggestions": {
    "comments": true,
    "strings": true
  },
Run Code Online (Sandbox Code Playgroud)