如何在Visual Studio Code中添加通用语言片段?

问题描述:

在正式的vscode文档中,我已经看到可以为每种语言创建自定义代码段。
https://code.visualstudio.com/Docs/customization/userdefinedsnippets

In official vscode documentation i have seen that is possible to create custom snippets for each language. https://code.visualstudio.com/Docs/customization/userdefinedsnippets

例如。 (languageId).json

但是如果我想定义所有语言通用的代码段?

But if i want to define snippets common for all languages? It is possible?

当前不支持普通用户代码段,但跟踪此功能请求的VSCode问题。请让我们知道这是否对您有用。

Common users snippets are currently not supported, but there is a VSCode issue tracking this feature request. Please let us know if this is something you would find useful.

出于完整性考虑, VSCode扩展程序可以为多种语言注册相同的代码段,但它们必须明确指定为其提供代码段的所有语言(是没有 language: * 选项)。

For completeness, VSCode extensions can register the same snippets for multiple languages but they must explicitly specify all languages they provide snippets for (there is no "language": "*" option).