blob: edf2a850a02aeb6cb08403c95d24c60bca7e599e (
plain)
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
|
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
import { Event } from 'vs/base/common/event';
import { IDisposable } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { Command } from 'vs/editor/common/languages';
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IAccessibilityInformation } from 'vs/platform/accessibility/common/accessibility';
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
import { IMarkdownString } from 'vs/base/common/htmlContent';
export function toKey(extension: ExtensionIdentifier | string, source: string) {
return `${typeof extension === 'string' ? extension : ExtensionIdentifier.toKey(extension)}|${source}`;
}
export const TimelinePaneId = 'timeline';
export interface TimelineItem {
/**
* The handle of the item must be unique across all the
* timeline items provided by this source.
*/
handle: string;
/**
* The identifier of the timeline provider this timeline item is from.
*/
source: string;
id?: string;
label: string;
description?: string;
tooltip?: string | IMarkdownString | undefined;
timestamp: number;
accessibilityInformation?: IAccessibilityInformation;
icon?: URI;
iconDark?: URI;
themeIcon?: ThemeIcon;
command?: Command;
contextValue?: string;
relativeTime?: string;
hideRelativeTime?: boolean;
}
export interface TimelineChangeEvent {
/**
* The identifier of the timeline provider this event is from.
*/
id: string;
/**
* The resource that has timeline entries changed or `undefined`
* if not known.
*/
uri: URI | undefined;
/**
* Whether to drop all timeline entries and refresh them again.
*/
reset: boolean;
}
export interface TimelineOptions {
cursor?: string;
limit?: number | { timestamp: number; id?: string };
}
export interface InternalTimelineOptions {
cacheResults: boolean;
resetCache: boolean;
}
export interface Timeline {
/**
* The identifier of the timeline provider this timeline is from.
*/
source: string;
items: TimelineItem[];
paging?: {
cursor: string | undefined;
};
}
export interface TimelineProvider extends TimelineProviderDescriptor, IDisposable {
onDidChange?: Event<TimelineChangeEvent>;
provideTimeline(uri: URI, options: TimelineOptions, token: CancellationToken, internalOptions?: InternalTimelineOptions): Promise<Timeline | undefined>;
}
export interface TimelineSource {
id: string;
label: string;
}
export interface TimelineProviderDescriptor {
/**
* An identifier of the source of the timeline items. This can be used to filter sources.
*/
id: string;
/**
* A human-readable string describing the source of the timeline items. This can be used as the display label when filtering sources.
*/
label: string;
/**
* The resource scheme(s) this timeline provider is providing entries for.
*/
scheme: string | string[];
}
export interface TimelineProvidersChangeEvent {
readonly added?: string[];
readonly removed?: string[];
}
export interface TimelineRequest {
readonly result: Promise<Timeline | undefined>;
readonly options: TimelineOptions;
readonly source: string;
readonly tokenSource: CancellationTokenSource;
readonly uri: URI;
}
export interface ITimelineService {
readonly _serviceBrand: undefined;
onDidChangeProviders: Event<TimelineProvidersChangeEvent>;
onDidChangeTimeline: Event<TimelineChangeEvent>;
onDidChangeUri: Event<URI>;
registerTimelineProvider(provider: TimelineProvider): IDisposable;
unregisterTimelineProvider(id: string): void;
getSources(): TimelineSource[];
getTimeline(id: string, uri: URI, options: TimelineOptions, tokenSource: CancellationTokenSource, internalOptions?: InternalTimelineOptions): TimelineRequest | undefined;
setUri(uri: URI): void;
}
const TIMELINE_SERVICE_ID = 'timeline';
export const ITimelineService = createDecorator<ITimelineService>(TIMELINE_SERVICE_ID);
|