问题
Just as I had trouble and it is not that obvious:
How can I add a new file when developing vscode extension?
回答1:
First you have to create a command (when using the vscode extension example put it in extension.ts) -> For example the hello world command.
You have to use openTextDocument method on the workspace and get the path for your project. Don't forget that you have to use "\" instead of "/" for the path:
let manifest = await vscode.workspace.openTextDocument(vscode.Uri.parse("untitled:"+vscode.workspace.rootPath+"\\projectmanifest.json"));
await manifest.save();
来源:https://stackoverflow.com/questions/40832729/how-to-add-a-new-file-to-the-workspace-when-developing-a-new-vscode-extension