mirror of
https://github.com/coder/code-server.git
synced 2026-05-17 09:47:25 +02:00
Squashed 'lib/vscode/' content from commit e5a624b788
git-subtree-dir: lib/vscode git-subtree-split: e5a624b788d92b8d34d1392e4c4d9789406efe8f
This commit is contained in:
23
extensions/vscode-custom-editor-tests/src/test/utils.ts
Normal file
23
extensions/vscode-custom-editor-tests/src/test/utils.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
export function randomFilePath(args: { root: vscode.Uri, ext: string }): vscode.Uri {
|
||||
const fileName = Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 10);
|
||||
return (vscode.Uri as any).joinPath(args.root, fileName + args.ext);
|
||||
}
|
||||
|
||||
export function closeAllEditors(): Thenable<any> {
|
||||
return vscode.commands.executeCommand('workbench.action.closeAllEditors');
|
||||
}
|
||||
|
||||
export function disposeAll(disposables: vscode.Disposable[]) {
|
||||
vscode.Disposable.from(...disposables).dispose();
|
||||
}
|
||||
|
||||
export function delay(ms: number) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
Reference in New Issue
Block a user