Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/platform/clipboard/test/common/testClipboardService.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { URI } from '../../../../base/common/uri.js';
7
import { IClipboardService } from '../../common/clipboardService.js';
8
9
export class TestClipboardService implements IClipboardService {
10
readImage(): Promise<Uint8Array> {
11
throw new Error('Method not implemented.');
12
}
13
14
_serviceBrand: undefined;
15
16
private text: string | undefined = undefined;
17
18
triggerPaste(): Promise<void> | undefined {
19
return Promise.resolve();
20
}
21
22
async writeText(text: string, type?: string): Promise<void> {
23
this.text = text;
24
}
25
26
async readText(type?: string): Promise<string> {
27
return this.text ?? '';
28
}
29
30
private findText: string | undefined = undefined;
31
32
async readFindText(): Promise<string> {
33
return this.findText ?? '';
34
}
35
36
async writeFindText(text: string): Promise<void> {
37
this.findText = text;
38
}
39
40
private resources: URI[] | undefined = undefined;
41
42
async writeResources(resources: URI[]): Promise<void> {
43
this.resources = resources;
44
}
45
46
async readResources(): Promise<URI[]> {
47
return this.resources ?? [];
48
}
49
50
async hasResources(): Promise<boolean> {
51
return Array.isArray(this.resources) && this.resources.length > 0;
52
}
53
}
54
55