From d3579747f36d3c81abc411fc4b1de0fc34821c03 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Thu, 6 Apr 2023 18:54:39 +0200 Subject: [PATCH] Fix unit tests --- .../test/browser/documentSemanticTokens.test.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/vs/editor/contrib/semanticTokens/test/browser/documentSemanticTokens.test.ts b/src/vs/editor/contrib/semanticTokens/test/browser/documentSemanticTokens.test.ts index 9a4c487642629..33ad9d64b49ea 100644 --- a/src/vs/editor/contrib/semanticTokens/test/browser/documentSemanticTokens.test.ts +++ b/src/vs/editor/contrib/semanticTokens/test/browser/documentSemanticTokens.test.ts @@ -96,6 +96,8 @@ suite('ModelSemanticColoring', () => { })); const textModel = disposables.add(modelService.createModel('Hello world', languageService.createById('testMode'))); + // pretend the text model is attached to an editor (so that semantic tokens are computed) + textModel.onBeforeAttached(); // wait for the provider to be called await inFirstCall.wait(); @@ -151,6 +153,8 @@ suite('ModelSemanticColoring', () => { })); const textModel = disposables.add(modelService.createModel('', languageService.createById('testMode'))); + // pretend the text model is attached to an editor (so that semantic tokens are computed) + textModel.onBeforeAttached(); // wait for the semantic tokens to be fetched await Event.toPromise(textModel.onDidChangeTokens); @@ -192,7 +196,9 @@ suite('ModelSemanticColoring', () => { } })); - disposables.add(modelService.createModel('', languageService.createById('testMode'))); + const textModel = disposables.add(modelService.createModel('', languageService.createById('testMode'))); + // pretend the text model is attached to an editor (so that semantic tokens are computed) + textModel.onBeforeAttached(); await timeout(5000); assert.deepStrictEqual(requestCount, 2);