ensure event comes from edit

This commit is contained in:
Tyler Leonhardt
2021-09-03 18:25:25 -07:00
parent e415d6ff35
commit 15dfc742a6

View File

@@ -15,8 +15,10 @@ suite('vscode - automatic language detection', () => {
});
test('test automatic language detection works', async () => {
const receivedEvent = asPromise(vscode.workspace.onDidOpenTextDocument, 5000);
const doc = await vscode.workspace.openTextDocument();
const editor = await vscode.window.showTextDocument(doc);
await receivedEvent;
assert.strictEqual(editor.document.languageId, 'plaintext');
@@ -60,6 +62,7 @@ suite('vscode - automatic language detection', () => {
// Changing the language triggers a file to be closed and opened again so wait for that event to happen.
const newDoc = await asPromise(vscode.workspace.onDidOpenTextDocument, 5000);
assert.strictEqual(doc.uri.toString(), newDoc.uri.toString());
assert.strictEqual(newDoc.languageId, 'json');
});
});