Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/platform/clipboard/common/clipboardService.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 { createDecorator } from '../../instantiation/common/instantiation.js';
8
9
export const IClipboardService = createDecorator<IClipboardService>('clipboardService');
10
11
export interface IClipboardService {
12
13
readonly _serviceBrand: undefined;
14
15
/**
16
* Trigger the paste. Returns undefined if the paste was not triggered or a promise that resolves on paste end.
17
*/
18
triggerPaste(targetWindowId: number): Promise<void> | undefined;
19
20
/**
21
* Writes text to the system clipboard.
22
*/
23
writeText(text: string, type?: string): Promise<void>;
24
25
/**
26
* Reads the content of the clipboard in plain text
27
*/
28
readText(type?: string): Promise<string>;
29
30
/**
31
* Reads text from the system find pasteboard.
32
*/
33
readFindText(): Promise<string>;
34
35
/**
36
* Writes text to the system find pasteboard.
37
*/
38
writeFindText(text: string): Promise<void>;
39
40
/**
41
* Writes resources to the system clipboard.
42
*/
43
writeResources(resources: URI[]): Promise<void>;
44
45
/**
46
* Reads resources from the system clipboard.
47
*/
48
readResources(): Promise<URI[]>;
49
50
/**
51
* Find out if resources are copied to the clipboard.
52
*/
53
hasResources(): Promise<boolean>;
54
55
/**
56
* Resets the internal state of the clipboard (if any) without touching the real clipboard.
57
*
58
* Used for implementations such as web which do not always support using the real clipboard.
59
*/
60
clearInternalState?(): void;
61
62
/**
63
* Reads resources from the system clipboard as an image. If the clipboard does not contain an
64
* image, an empty buffer is returned.
65
*/
66
readImage(): Promise<Uint8Array>;
67
}
68
69