Fix configure ts/jsconfig.json inserting duplicate snippet for unsaved file. Fixes #27793

This commit is contained in:
Matt Bierner
2017-06-02 14:53:10 -07:00
parent 6e8b0229b8
commit c353e6e9b0

View File

@@ -593,7 +593,13 @@ class TypeScriptServiceClientHost implements ITypescriptServiceClientHost {
}, _ => {
return workspace.openTextDocument(configFile.with({ scheme: 'untitled' }))
.then(doc => window.showTextDocument(doc, col))
.then(editor => editor.insertSnippet(new SnippetString('{\n\t$0\n}')));
.then(editor => {
if (editor.document.getText().length === 0) {
return editor.insertSnippet(new SnippetString('{\n\t$0\n}'))
.then(_ => editor);
}
return editor;
});
});
case ProjectConfigAction.LearnMore: