mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 13:29:44 +00:00
Adding more explicit typings for promises
This gets us ready for TS 4.1
This commit is contained in:
parent
2a954244f0
commit
c348165cc0
|
@ -53,7 +53,7 @@ async function uploadBlob(blobService: azure.BlobService, quality: string, blobN
|
|||
}
|
||||
};
|
||||
|
||||
await new Promise((c, e) => blobService.createBlockBlobFromLocalFile(quality, blobName, filePath, blobOptions, err => err ? e(err) : c()));
|
||||
await new Promise<void>((c, e) => blobService.createBlockBlobFromLocalFile(quality, blobName, filePath, blobOptions, err => err ? e(err) : c()));
|
||||
}
|
||||
|
||||
function getEnv(name: string): string {
|
||||
|
|
|
@ -17,7 +17,7 @@ const fileNames = [
|
|||
];
|
||||
|
||||
async function assertContainer(blobService: azure.BlobService, container: string): Promise<void> {
|
||||
await new Promise((c, e) => blobService.createContainerIfNotExists(container, { publicAccessLevel: 'blob' }, err => err ? e(err) : c()));
|
||||
await new Promise<void>((c, e) => blobService.createContainerIfNotExists(container, { publicAccessLevel: 'blob' }, err => err ? e(err) : c()));
|
||||
}
|
||||
|
||||
async function doesBlobExist(blobService: azure.BlobService, container: string, blobName: string): Promise<boolean | undefined> {
|
||||
|
@ -33,7 +33,7 @@ async function uploadBlob(blobService: azure.BlobService, container: string, blo
|
|||
}
|
||||
};
|
||||
|
||||
await new Promise((c, e) => blobService.createBlockBlobFromLocalFile(container, blobName, file, blobOptions, err => err ? e(err) : c()));
|
||||
await new Promise<void>((c, e) => blobService.createBlockBlobFromLocalFile(container, blobName, file, blobOptions, err => err ? e(err) : c()));
|
||||
}
|
||||
|
||||
async function publish(commit: string, files: readonly string[]): Promise<void> {
|
||||
|
|
|
@ -996,7 +996,7 @@ function createResource(project: string, slug: string, xlfFile: File, apiHostnam
|
|||
* https://dev.befoolish.co/tx-docs/public/projects/updating-content#what-happens-when-you-update-files
|
||||
*/
|
||||
function updateResource(project: string, slug: string, xlfFile: File, apiHostname: string, credentials: string): Promise<any> {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
const data = JSON.stringify({ content: xlfFile.contents.toString() });
|
||||
const options = {
|
||||
hostname: apiHostname,
|
||||
|
|
|
@ -15,7 +15,7 @@ const yarn = process.platform === 'win32' ? 'yarn.cmd' : 'yarn';
|
|||
const rootDir = path.resolve(__dirname, '..', '..');
|
||||
|
||||
function runProcess(command: string, args: ReadonlyArray<string> = []) {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
const child = spawn(command, args, { cwd: rootDir, stdio: 'inherit', env: process.env });
|
||||
child.on('exit', err => !err ? resolve() : process.exit(err ?? 1));
|
||||
child.on('error', reject);
|
||||
|
|
|
@ -527,7 +527,7 @@ suite('Async', () => {
|
|||
|
||||
r1Queue.queue(syncPromiseFactory);
|
||||
|
||||
return new Promise(c => setTimeout(() => c(), 0)).then(() => {
|
||||
return new Promise<void>(c => setTimeout(() => c(), 0)).then(() => {
|
||||
const r1Queue2 = queue.queueFor(URI.file('/some/path'));
|
||||
assert.notEqual(r1Queue, r1Queue2); // previous one got disposed after finishing
|
||||
});
|
||||
|
|
|
@ -25,21 +25,21 @@ export class DeferredPromise<T> {
|
|||
}
|
||||
|
||||
public complete(value: T) {
|
||||
return new Promise(resolve => {
|
||||
return new Promise<void>(resolve => {
|
||||
this.completeCallback(value);
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
|
||||
public error(err: any) {
|
||||
return new Promise(resolve => {
|
||||
return new Promise<void>(resolve => {
|
||||
this.errorCallback(err);
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
|
||||
public cancel() {
|
||||
new Promise(resolve => {
|
||||
new Promise<void>(resolve => {
|
||||
this.errorCallback(canceled());
|
||||
resolve();
|
||||
});
|
||||
|
|
|
@ -138,7 +138,7 @@ export async function main(argv: string[]): Promise<any> {
|
|||
child.stdout!.on('data', (data: Buffer) => console.log(data.toString('utf8').trim()));
|
||||
child.stderr!.on('data', (data: Buffer) => console.log(data.toString('utf8').trim()));
|
||||
|
||||
await new Promise(c => child.once('exit', () => c()));
|
||||
await new Promise<void>(c => child.once('exit', () => c()));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -290,7 +290,7 @@ suite('ParameterHintsModel', () => {
|
|||
hintsModel.trigger({ triggerKind: modes.SignatureHelpTriggerKind.Invoke }, 0);
|
||||
assert.strictEqual(-1, didRequestCancellationOf);
|
||||
|
||||
return new Promise((resolve, reject) =>
|
||||
return new Promise<void>((resolve, reject) =>
|
||||
hintsModel.onChangedHints(newParamterHints => {
|
||||
try {
|
||||
assert.strictEqual(0, didRequestCancellationOf);
|
||||
|
|
|
@ -104,7 +104,7 @@ suite('On type rename', () => {
|
|||
|
||||
await operations(testEditor);
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
setTimeout(() => {
|
||||
if (typeof expectedEndText === 'string') {
|
||||
assert.equal(editor.getModel()!.getValue(), expectedEndText);
|
||||
|
|
|
@ -19,8 +19,8 @@ export class BracketSelectionRangeProvider implements SelectionRangeProvider {
|
|||
result.push(bucket);
|
||||
|
||||
const ranges = new Map<string, LinkedList<Range>>();
|
||||
await new Promise(resolve => BracketSelectionRangeProvider._bracketsRightYield(resolve, 0, model, position, ranges));
|
||||
await new Promise(resolve => BracketSelectionRangeProvider._bracketsLeftYield(resolve, 0, model, position, ranges, bucket));
|
||||
await new Promise<void>(resolve => BracketSelectionRangeProvider._bracketsRightYield(resolve, 0, model, position, ranges));
|
||||
await new Promise<void>(resolve => BracketSelectionRangeProvider._bracketsLeftYield(resolve, 0, model, position, ranges, bucket));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -89,7 +89,7 @@ suite('ConfigurationService', () => {
|
|||
test('trigger configuration change event when file does not exist', async () => {
|
||||
const testObject = disposables.add(new ConfigurationService(settingsResource, fileService));
|
||||
await testObject.initialize();
|
||||
return new Promise(async (c, e) => {
|
||||
return new Promise<void>(async (c) => {
|
||||
disposables.add(Event.filter(testObject.onDidChangeConfiguration, e => e.source === ConfigurationTarget.USER)(() => {
|
||||
assert.equal(testObject.getValue('foo'), 'bar');
|
||||
c();
|
||||
|
@ -104,7 +104,7 @@ suite('ConfigurationService', () => {
|
|||
await fileService.writeFile(settingsResource, VSBuffer.fromString('{ "foo": "bar" }'));
|
||||
await testObject.initialize();
|
||||
|
||||
return new Promise((c, e) => {
|
||||
return new Promise<void>((c) => {
|
||||
disposables.add(Event.filter(testObject.onDidChangeConfiguration, e => e.source === ConfigurationTarget.USER)(async (e) => {
|
||||
assert.equal(testObject.getValue('foo'), 'barz');
|
||||
c();
|
||||
|
|
|
@ -101,7 +101,7 @@ export class ElectronExtensionHostDebugBroadcastChannel<TContext> extends Extens
|
|||
});
|
||||
});
|
||||
|
||||
await new Promise(r => server.listen(0, r));
|
||||
await new Promise<void>(r => server.listen(0, r));
|
||||
codeWindow.win.on('close', () => server.close());
|
||||
|
||||
return { rendererDebugPort: (server.address() as AddressInfo).port };
|
||||
|
|
|
@ -73,7 +73,7 @@ export class MainThreadProgress implements MainThreadProgressShape {
|
|||
|
||||
private _createTask(handle: number) {
|
||||
return (progress: IProgress<IProgressStep>) => {
|
||||
return new Promise<any>(resolve => {
|
||||
return new Promise<void>(resolve => {
|
||||
this._progress.set(handle, { resolve, progress });
|
||||
});
|
||||
};
|
||||
|
|
|
@ -198,7 +198,7 @@ export class DebugViewPaneContainer extends ViewPaneContainer {
|
|||
|
||||
if (state === State.Initializing) {
|
||||
this.progressService.withProgress({ location: VIEWLET_ID, }, _progress => {
|
||||
return new Promise(resolve => this.progressResolve = resolve);
|
||||
return new Promise<void>(resolve => this.progressResolve = resolve);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -469,7 +469,7 @@ suite('ExtensionsActions', () => {
|
|||
testObject.extension = extensions[0];
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(aGalleryExtension('a', { identifier: local.identifier, version: '1.0.1' })));
|
||||
assert.ok(!testObject.enabled);
|
||||
return new Promise(c => {
|
||||
return new Promise<void>(c => {
|
||||
testObject.onDidChange(() => {
|
||||
if (testObject.enabled) {
|
||||
c();
|
||||
|
@ -1025,7 +1025,7 @@ suite('ExtensionsActions', () => {
|
|||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(aGalleryExtension('a', { identifier: local[0].identifier, version: '1.0.2' }), aGalleryExtension('b', { identifier: local[1].identifier, version: '1.0.2' }), aGalleryExtension('c', local[2].manifest)));
|
||||
assert.ok(!testObject.enabled);
|
||||
return new Promise(c => {
|
||||
return new Promise<void>(c => {
|
||||
testObject.onDidChange(() => {
|
||||
if (testObject.enabled) {
|
||||
c();
|
||||
|
@ -1046,7 +1046,7 @@ suite('ExtensionsActions', () => {
|
|||
.then(async () => {
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(...gallery));
|
||||
assert.ok(!testObject.enabled);
|
||||
return new Promise(c => {
|
||||
return new Promise<void>(c => {
|
||||
installEvent.fire({ identifier: local[0].identifier, gallery: gallery[0] });
|
||||
testObject.onDidChange(() => {
|
||||
if (testObject.enabled) {
|
||||
|
@ -1246,7 +1246,7 @@ suite('ReloadAction', () => {
|
|||
const extensions = await workbenchService.queryLocal();
|
||||
testObject.extension = extensions[0];
|
||||
|
||||
return new Promise(c => {
|
||||
return new Promise<void>(c => {
|
||||
testObject.onDidChange(() => {
|
||||
if (testObject.enabled && testObject.tooltip === 'Please reload Visual Studio Code to enable the updated extension.') {
|
||||
c();
|
||||
|
|
|
@ -321,7 +321,7 @@ export class NotebookTextDiffEditor extends EditorPane implements INotebookTextD
|
|||
r();
|
||||
}));
|
||||
|
||||
return new Promise(resolve => { r = resolve; });
|
||||
return new Promise<void>(resolve => { r = resolve; });
|
||||
}
|
||||
|
||||
getDomNode() {
|
||||
|
|
|
@ -760,7 +760,7 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
|
|||
upwards = true;
|
||||
}
|
||||
|
||||
const editorAttachedPromise = new Promise((resolve, reject) => {
|
||||
const editorAttachedPromise = new Promise<void>((resolve, reject) => {
|
||||
element.onDidChangeEditorAttachState(() => {
|
||||
element.editorAttached ? resolve() : reject();
|
||||
});
|
||||
|
@ -1052,7 +1052,7 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
|
|||
}
|
||||
|
||||
function getEditorAttachedPromise(element: CellViewModel) {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
Event.once(element.onDidChangeEditorAttachState)(() => element.editorAttached ? resolve() : reject());
|
||||
});
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ export class StartupProfiler implements IWorkbenchContribution {
|
|||
const removeArgs: string[] = ['--prof-startup'];
|
||||
const markerFile = readFile(profileFilenamePrefix).then(value => removeArgs.push(...value.toString().split('|')))
|
||||
.then(() => rimraf(profileFilenamePrefix)) // (1) delete the file to tell the main process to stop profiling
|
||||
.then(() => new Promise(resolve => { // (2) wait for main that recreates the fail to signal profiling has stopped
|
||||
.then(() => new Promise<void>(resolve => { // (2) wait for main that recreates the fail to signal profiling has stopped
|
||||
const check = () => {
|
||||
exists(profileFilenamePrefix).then(exists => {
|
||||
if (exists) {
|
||||
|
|
|
@ -274,7 +274,7 @@ class HelpItemValue {
|
|||
constructor(private commandService: ICommandService, public extensionDescription: IExtensionDescription, public remoteAuthority: string[] | undefined, private urlOrCommand?: string) { }
|
||||
|
||||
get url(): Promise<string> {
|
||||
return new Promise(async (resolve) => {
|
||||
return new Promise<string>(async (resolve) => {
|
||||
if (this._url === undefined) {
|
||||
if (this.urlOrCommand) {
|
||||
let url = URI.parse(this.urlOrCommand);
|
||||
|
|
|
@ -596,7 +596,7 @@ export class SearchView extends ViewPane {
|
|||
this.progressService.withProgress({ location: this.getProgressLocation(), delay: 100, total: occurrences }, p => {
|
||||
progressReporter = p;
|
||||
|
||||
return new Promise(resolve => progressComplete = resolve);
|
||||
return new Promise<void>(resolve => progressComplete = resolve);
|
||||
});
|
||||
|
||||
const confirmation: IConfirmation = {
|
||||
|
@ -1398,7 +1398,7 @@ export class SearchView extends ViewPane {
|
|||
private doSearch(query: ITextQuery, excludePatternText: string, includePatternText: string, triggeredOnType: boolean): Thenable<void> {
|
||||
let progressComplete: () => void;
|
||||
this.progressService.withProgress({ location: this.getProgressLocation(), delay: triggeredOnType ? 300 : 0 }, _progress => {
|
||||
return new Promise(resolve => progressComplete = resolve);
|
||||
return new Promise<void>(resolve => progressComplete = resolve);
|
||||
});
|
||||
|
||||
this.searchWidget.searchInput.clearMessage();
|
||||
|
|
|
@ -737,7 +737,7 @@ export class SearchResult extends Disposable {
|
|||
set query(query: ITextQuery | null) {
|
||||
// When updating the query we could change the roots, so keep a reference to them to clean up when we trigger `disposePastResults`
|
||||
const oldFolderMatches = this.folderMatches();
|
||||
new Promise(resolve => this.disposePastResults = resolve)
|
||||
new Promise<void>(resolve => this.disposePastResults = resolve)
|
||||
.then(() => oldFolderMatches.forEach(match => match.clear()))
|
||||
.then(() => oldFolderMatches.forEach(match => match.dispose()))
|
||||
.then(() => this._isDirty = false);
|
||||
|
|
|
@ -207,7 +207,7 @@ suite('FileQueryCacheState', () => {
|
|||
}
|
||||
|
||||
public awaitDisposal(n: number) {
|
||||
return new Promise(resolve => {
|
||||
return new Promise<void>(resolve => {
|
||||
if (n === Object.keys(this.disposing).length) {
|
||||
resolve();
|
||||
} else {
|
||||
|
|
|
@ -91,7 +91,7 @@ class InsertSnippetAction extends EditorAction {
|
|||
const clipboardService = accessor.get(IClipboardService);
|
||||
const quickInputService = accessor.get(IQuickInputService);
|
||||
|
||||
const snippet = await new Promise<Snippet>(async (resolve, reject) => {
|
||||
const snippet = await new Promise<Snippet | undefined>(async (resolve, reject) => {
|
||||
|
||||
const { lineNumber, column } = editor.getPosition();
|
||||
let { snippet, name, langId } = Args.fromUser(arg);
|
||||
|
|
|
@ -43,9 +43,9 @@ export class TerminalProcessExtHostProxy extends Disposable implements ITerminal
|
|||
private readonly _onRequestLatency = this._register(new Emitter<void>());
|
||||
public readonly onRequestLatency: Event<void> = this._onRequestLatency.event;
|
||||
|
||||
private _pendingInitialCwdRequests: ((value?: string | Thenable<string>) => void)[] = [];
|
||||
private _pendingCwdRequests: ((value?: string | Thenable<string>) => void)[] = [];
|
||||
private _pendingLatencyRequests: ((value?: number | Thenable<number>) => void)[] = [];
|
||||
private _pendingInitialCwdRequests: ((value: string | Thenable<string>) => void)[] = [];
|
||||
private _pendingCwdRequests: ((value: string | Thenable<string>) => void)[] = [];
|
||||
private _pendingLatencyRequests: ((value: number | Thenable<number>) => void)[] = [];
|
||||
|
||||
constructor(
|
||||
public terminalId: number,
|
||||
|
|
|
@ -147,7 +147,7 @@ abstract class AbstractIconThemeAction extends Action {
|
|||
}, applyTheme ? 0 : 200);
|
||||
};
|
||||
|
||||
return new Promise((s, _) => {
|
||||
return new Promise<void>((s, _) => {
|
||||
let isCompleted = false;
|
||||
|
||||
const autoFocusIndex = firstIndex(picks, p => isItem(p) && p.id === currentTheme.id);
|
||||
|
|
|
@ -949,7 +949,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
|
|||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor): any {
|
||||
return new Promise((c, e) => {
|
||||
return new Promise<void>((c, e) => {
|
||||
const quickInputService = accessor.get(IQuickInputService);
|
||||
const commandService = accessor.get(ICommandService);
|
||||
const disposables = new DisposableStore();
|
||||
|
|
|
@ -329,7 +329,7 @@ export class AuthenticationService extends Disposable implements IAuthentication
|
|||
// Activate has already been called for the authentication provider, but it cannot block on registering itself
|
||||
// since this is sync and returns a disposable. So, wait for registration event to fire that indicates the
|
||||
// provider is now in the map.
|
||||
await new Promise((resolve, _) => {
|
||||
await new Promise<void>((resolve, _) => {
|
||||
this.onDidRegisterAuthenticationProvider(e => {
|
||||
if (e.id === providerId) {
|
||||
provider = this._authenticationProviders.get(providerId);
|
||||
|
|
|
@ -1191,14 +1191,14 @@ suite('WorkspaceConfigurationService - Folder', () => {
|
|||
|
||||
test('change event when there are global tasks', () => {
|
||||
fs.writeFileSync(globalTasksFile, '{ "version": "1.0.0", "tasks": [{ "taskName": "myTask" }');
|
||||
return new Promise((c) => testObject.onDidChangeConfiguration(() => c()));
|
||||
return new Promise<void>((c) => testObject.onDidChangeConfiguration(() => c()));
|
||||
});
|
||||
|
||||
test('creating workspace settings', async () => {
|
||||
fs.writeFileSync(globalSettingsFile, '{ "configurationService.folder.testSetting": "userValue" }');
|
||||
await testObject.reloadConfiguration();
|
||||
const workspaceSettingsResource = URI.file(path.join(workspaceDir, '.vscode', 'settings.json'));
|
||||
await new Promise(async (c) => {
|
||||
await new Promise<void>(async (c) => {
|
||||
const disposable = testObject.onDidChangeConfiguration(e => {
|
||||
assert.ok(e.affectsConfiguration('configurationService.folder.testSetting'));
|
||||
assert.equal(testObject.getValue('configurationService.folder.testSetting'), 'workspaceValue');
|
||||
|
@ -1217,7 +1217,7 @@ suite('WorkspaceConfigurationService - Folder', () => {
|
|||
const workspaceSettingsResource = URI.file(path.join(workspaceDir, '.vscode', 'settings.json'));
|
||||
await fileService.writeFile(workspaceSettingsResource, VSBuffer.fromString('{ "configurationService.folder.testSetting": "workspaceValue" }'));
|
||||
await testObject.reloadConfiguration();
|
||||
await new Promise(async (c) => {
|
||||
await new Promise<void>(async (c) => {
|
||||
const disposable = testObject.onDidChangeConfiguration(e => {
|
||||
assert.ok(e.affectsConfiguration('configurationService.folder.testSetting'));
|
||||
assert.equal(testObject.getValue('configurationService.folder.testSetting'), 'userValue');
|
||||
|
@ -1822,7 +1822,7 @@ suite('WorkspaceConfigurationService-Multiroot', () => {
|
|||
await workspaceService.removeFolders([uri]);
|
||||
fs.writeFileSync(path.join(uri.fsPath, '.vscode', 'settings.json'), '{ "configurationService.workspace.testResourceSetting": "workspaceFolderValue" }');
|
||||
|
||||
return new Promise((c, e) => {
|
||||
return new Promise<void>((c, e) => {
|
||||
testObject.onDidChangeConfiguration(() => {
|
||||
try {
|
||||
assert.equal(testObject.getValue('configurationService.workspace.testResourceSetting', { resource: uri }), 'workspaceFolderValue');
|
||||
|
@ -1948,7 +1948,7 @@ suite('WorkspaceConfigurationService - Remote Folder', () => {
|
|||
fs.writeFileSync(remoteSettingsFile, '{ "configurationService.remote.machineSetting": "remoteValue" }');
|
||||
registerRemoteFileSystemProvider();
|
||||
await initialize();
|
||||
const promise = new Promise((c, e) => {
|
||||
const promise = new Promise<void>((c, e) => {
|
||||
testObject.onDidChangeConfiguration(event => {
|
||||
try {
|
||||
assert.equal(event.source, ConfigurationTarget.USER);
|
||||
|
@ -1968,7 +1968,7 @@ suite('WorkspaceConfigurationService - Remote Folder', () => {
|
|||
fs.writeFileSync(remoteSettingsFile, '{ "configurationService.remote.machineSetting": "remoteValue" }');
|
||||
registerRemoteFileSystemProviderOnActivation();
|
||||
await initialize();
|
||||
const promise = new Promise((c, e) => {
|
||||
const promise = new Promise<void>((c, e) => {
|
||||
testObject.onDidChangeConfiguration(event => {
|
||||
try {
|
||||
assert.equal(event.source, ConfigurationTarget.USER);
|
||||
|
@ -1989,7 +1989,7 @@ suite('WorkspaceConfigurationService - Remote Folder', () => {
|
|||
resolveRemoteEnvironment();
|
||||
await initialize();
|
||||
assert.equal(testObject.getValue('configurationService.remote.machineSetting'), 'isSet');
|
||||
const promise = new Promise((c, e) => {
|
||||
const promise = new Promise<void>((c, e) => {
|
||||
testObject.onDidChangeConfiguration(event => {
|
||||
try {
|
||||
assert.equal(event.source, ConfigurationTarget.USER);
|
||||
|
|
|
@ -94,7 +94,7 @@ suite('DecorationsService', function () {
|
|||
|
||||
// un-register -> ensure good event
|
||||
let didSeeEvent = false;
|
||||
let p = new Promise(resolve => {
|
||||
let p = new Promise<void>(resolve => {
|
||||
service.onDidChangeDecorations(e => {
|
||||
assert.equal(e.affectsResource(uri), true);
|
||||
assert.deepEqual(service.getDecoration(uri, false), undefined);
|
||||
|
@ -275,7 +275,7 @@ suite('DecorationsService', function () {
|
|||
data = service.getDecoration(uri2, true)!;
|
||||
assert.ok(data.tooltip); // emphazied items...
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let l = service.onDidChangeDecorations(e => {
|
||||
l.dispose();
|
||||
try {
|
||||
|
|
|
@ -58,7 +58,7 @@ suite('Workbench - TextModelResolverService', () => {
|
|||
assert.ok(model);
|
||||
assert.equal(snapshotToString(((model as ResourceEditorModel).createSnapshot()!)), 'Hello Test');
|
||||
let disposed = false;
|
||||
let disposedPromise = new Promise(resolve => {
|
||||
let disposedPromise = new Promise<void>(resolve => {
|
||||
Event.once(model.onDispose)(() => {
|
||||
disposed = true;
|
||||
resolve();
|
||||
|
@ -201,7 +201,7 @@ suite('Workbench - TextModelResolverService', () => {
|
|||
modelRef1.dispose();
|
||||
assert(!textModel.isDisposed(), 'the text model should still not be disposed');
|
||||
|
||||
let p1 = new Promise(resolve => textModel.onWillDispose(resolve));
|
||||
let p1 = new Promise<void>(resolve => textModel.onWillDispose(resolve));
|
||||
modelRef2.dispose();
|
||||
|
||||
await p1;
|
||||
|
|
|
@ -207,7 +207,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
|||
|
||||
let sub = participant.getOnWillSaveTextDocumentEvent(nullExtensionDescription)(function (event) {
|
||||
|
||||
event.waitUntil(new Promise((resolve, reject) => {
|
||||
event.waitUntil(new Promise<undefined>((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
try {
|
||||
assert.throws(() => event.waitUntil(timeout(10)));
|
||||
|
|
|
@ -135,7 +135,7 @@ suite('NotebookCell#Document', function () {
|
|||
|
||||
test('cell document is vscode.TextDocument after changing it', async function () {
|
||||
|
||||
const p = new Promise((resolve, reject) => {
|
||||
const p = new Promise<void>((resolve, reject) => {
|
||||
extHostNotebooks.onDidChangeNotebookCells(e => {
|
||||
try {
|
||||
assert.strictEqual(e.changes.length, 1);
|
||||
|
|
|
@ -248,7 +248,7 @@ suite('ExtHostTreeView', function () {
|
|||
});
|
||||
|
||||
async function runWithEventMerging(action: (resolve: () => void) => void) {
|
||||
await new Promise((resolve) => {
|
||||
await new Promise<void>((resolve) => {
|
||||
let subscription: IDisposable | undefined = undefined;
|
||||
subscription = target.onRefresh.event(() => {
|
||||
subscription!.dispose();
|
||||
|
@ -256,7 +256,7 @@ suite('ExtHostTreeView', function () {
|
|||
});
|
||||
onDidChangeTreeNode.fire(getNode('b'));
|
||||
});
|
||||
await new Promise(action);
|
||||
await new Promise<void>(action);
|
||||
}
|
||||
|
||||
test('refresh parent and child node trigger refresh only on parent - scenario 1', async () => {
|
||||
|
|
|
@ -35,7 +35,7 @@ suite('MainThreadDocumentContentProviders', function () {
|
|||
},
|
||||
);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let expectedEvents = 1;
|
||||
model.onDidChangeContent(e => {
|
||||
expectedEvents -= 1;
|
||||
|
|
Loading…
Reference in a new issue