mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-19 16:18:58 +01:00
ensure event comes from edit
This commit is contained in:
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user