提交 54b0654c 编写于 作者: M Matt Bierner

use async for create config file

上级 36aa3a01
......@@ -29,15 +29,13 @@ export function openOrCreateConfigFile(
return vscode.workspace.openTextDocument(configFile)
.then(doc => {
return vscode.window.showTextDocument(doc, col);
}, _ => {
return vscode.workspace.openTextDocument(configFile.with({ scheme: 'untitled' }))
.then(doc => vscode.window.showTextDocument(doc, col))
.then(editor => {
if (editor.document.getText().length === 0) {
return editor.insertSnippet(emptyConfig)
.then(_ => editor);
}
return editor;
});
}, async () => {
const doc = await vscode.workspace.openTextDocument(configFile.with({ scheme: 'untitled' }));
const editor = await vscode.window.showTextDocument(doc, col);
if (editor.document.getText().length === 0) {
await editor.insertSnippet(emptyConfig);
return editor;
}
return editor;
});
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册