我想添加一些项目特定的代码段。
如何在.vscode
文件夹中添加摘要?
答案 0 :(得分:5)
这有帮助吗?它来自最新的VSCode release (1.28.1)。
答案 1 :(得分:2)
据我所知,这在VS Code中根本无法直接实现。阅读完VS代码文档后:https://code.visualstudio.com/docs/editor/userdefinedsnippets< - 我发现没有提到这一点。
度过愉快的一天。
答案 2 :(得分:1)
转到File -> Prefrences -> User snippets
。
选择New Snippets for ${project name}
。
为代码段文件选择一个名称。
阅读刚刚创建的文件中的注释,然后复制示例以创建第一个片段。
答案 3 :(得分:0)
每this solution on vscode issues in github,您只需要:
schema = {'names': ['Field1', 'Field2', 'Field3'], 'type': ['STRING', 'STRING', 'INTEGER']}
data = []
for n,t in zip(schema['names'], schema['type']):
data.append({'name': n, 'type': t})
的文件(例如.code-snippets
),并typescript.code-snippets
的简单fog
代码段:console.log
{
"Print to console": {
"prefix": "fog",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
}
文件夹中(但不在其子文件夹中)。在VS Code 1.36.1上,它就像一个魅力。