-
Notifications
You must be signed in to change notification settings - Fork 29.8k
/
vscode.proposed.timeline.d.ts
163 lines (140 loc) · 5.41 KB
/
vscode.proposed.timeline.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module 'vscode' {
// https://github.com/microsoft/vscode/issues/84297
export class TimelineItem {
/**
* A timestamp (in milliseconds since 1 January 1970 00:00:00) for when the timeline item occurred.
*/
timestamp: number;
/**
* A human-readable string describing the timeline item.
*/
label: string;
/**
* Optional id for the timeline item. It must be unique across all the timeline items provided by this source.
*
* If not provided, an id is generated using the timeline item's timestamp.
*/
id?: string;
/**
* The icon path or {@link ThemeIcon} for the timeline item.
*/
iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon;
/**
* A human readable string describing less prominent details of the timeline item.
*/
description?: string;
/**
* The tooltip text when you hover over the timeline item.
*/
tooltip?: string | MarkdownString | undefined;
/**
* The {@link Command} that should be executed when the timeline item is selected.
*/
command?: Command;
/**
* Context value of the timeline item. This can be used to contribute specific actions to the item.
* For example, a timeline item is given a context value as `commit`. When contributing actions to `timeline/item/context`
* using `menus` extension point, you can specify context value for key `timelineItem` in `when` expression like `timelineItem == commit`.
* ```
* "contributes": {
* "menus": {
* "timeline/item/context": [
* {
* "command": "extension.copyCommitId",
* "when": "timelineItem == commit"
* }
* ]
* }
* }
* ```
* This will show the `extension.copyCommitId` action only for items where `contextValue` is `commit`.
*/
contextValue?: string;
/**
* Accessibility information used when screen reader interacts with this timeline item.
*/
accessibilityInformation?: AccessibilityInformation;
/**
* @param label A human-readable string describing the timeline item
* @param timestamp A timestamp (in milliseconds since 1 January 1970 00:00:00) for when the timeline item occurred
*/
constructor(label: string, timestamp: number);
}
export interface TimelineChangeEvent {
/**
* The {@link Uri} of the resource for which the timeline changed.
*/
uri: Uri;
/**
* A flag which indicates whether the entire timeline should be reset.
*/
reset?: boolean;
}
export interface Timeline {
readonly paging?: {
/**
* A provider-defined cursor specifying the starting point of timeline items which are after the ones returned.
* Use `undefined` to signal that there are no more items to be returned.
*/
readonly cursor: string | undefined;
};
/**
* An array of {@link TimelineItem timeline items}.
*/
readonly items: readonly TimelineItem[];
}
export interface TimelineOptions {
/**
* A provider-defined cursor specifying the starting point of the timeline items that should be returned.
*/
cursor?: string;
/**
* An optional maximum number timeline items or the all timeline items newer (inclusive) than the timestamp or id that should be returned.
* If `undefined` all timeline items should be returned.
*/
limit?: number | { timestamp: number; id?: string };
}
export interface TimelineProvider {
/**
* An optional event to signal that the timeline for a source has changed.
* To signal that the timeline for all resources (uris) has changed, do not pass any argument or pass `undefined`.
*/
onDidChange?: Event<TimelineChangeEvent | undefined>;
/**
* An identifier of the source of the timeline items. This can be used to filter sources.
*/
readonly id: string;
/**
* A human-readable string describing the source of the timeline items. This can be used as the display label when filtering sources.
*/
readonly label: string;
/**
* Provide {@link TimelineItem timeline items} for a {@link Uri}.
*
* @param uri The {@link Uri} of the file to provide the timeline for.
* @param options A set of options to determine how results should be returned.
* @param token A cancellation token.
* @return The {@link TimelineResult timeline result} or a thenable that resolves to such. The lack of a result
* can be signaled by returning `undefined`, `null`, or an empty array.
*/
provideTimeline(uri: Uri, options: TimelineOptions, token: CancellationToken): ProviderResult<Timeline>;
}
export namespace workspace {
/**
* Register a timeline provider.
*
* Multiple providers can be registered. In that case, providers are asked in
* parallel and the results are merged. A failing provider (rejected promise or exception) will
* not cause a failure of the whole operation.
*
* @param scheme A scheme or schemes that defines which documents this provider is applicable to. Can be `*` to target all documents.
* @param provider A timeline provider.
* @return A {@link Disposable} that unregisters this provider when being disposed.
*/
export function registerTimelineProvider(scheme: string | string[], provider: TimelineProvider): Disposable;
}
}