Repository navigation
Closed
Labels
Milestone
Description
Refs: #84297
- anyOS Daniel Imms (@Tyriar)
- anyOS SteVen Batten (@sbatten)
Complexity: 4
Testing
Extensions can now contribute timeline providers to show time-series information in a new Timeline view in the Explorer sidebar.
Develop an extension that can contribute a TimelineProvider to provide time-series information given a Uri. Here is an example provider.
Here is the current API declarations:
vscode/src/vs/vscode.proposed.d.ts
Lines 1473 to 1565 in 4f42834
| //#region eamodio - timeline: 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. When `falsy`, it is derived from [resourceUri](#TreeItem.resourceUri). | |
| */ | |
| label: string; | |
| /** | |
| * Optional id for the timeline item. See [TreeItem.id](#TreeItem.id) for more details. | |
| */ | |
| id?: string; | |
| /** | |
| * The icon path or [ThemeIcon](#ThemeIcon) for the timeline item. See [TreeItem.iconPath](#TreeItem.iconPath) for more details. | |
| */ | |
| iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon; | |
| /** | |
| * A human readable string describing less prominent details of the timeline item. See [TreeItem.description](#TreeItem.description) for more details. | |
| */ | |
| description?: string; | |
| /** | |
| * The tooltip text when you hover over the timeline item. | |
| */ | |
| detail?: string; | |
| /** | |
| * The [command](#Command) that should be executed when the timeline item is selected. | |
| */ | |
| command?: Command; | |
| /** | |
| * Context value of the timeline item. See [TreeItem.contextValue](#TreeItem.contextValue) for more details. | |
| */ | |
| contextValue?: string; | |
| /** | |
| * @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 | |
| * @param source A human-readable string describing the source of the timeline item | |
| */ | |
| constructor(label: string, timestamp: number, source: string); | |
| } | |
| export interface TimelineProvider { | |
| onDidChange?: Event<Uri | undefined>; | |
| /** | |
| * An identifier of the source of the timeline items. This can be used for filtering and/or overriding existing sources. | |
| */ | |
| source: string; | |
| /** | |
| * A human-readable string describing the source of the timeline items. This can be as the display label when filtering by sources. | |
| */ | |
| sourceDescription: string; | |
| replaceable?: boolean; | |
| /** | |
| * Provide [timeline items](#TimelineItem) for a [Uri](#Uri). | |
| * | |
| * @param uri The uri of the file to provide the timeline for. | |
| * @param token A cancellation token. | |
| * @return An array of timeline items 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, token: CancellationToken): ProviderResult<TimelineItem[]>; | |
| } | |
| 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 selector A selector that defines the documents this provider is applicable to. | |
| * @param provider A timeline provider. | |
| * @return A [disposable](#Disposable) that unregisters this provider when being disposed. | |
| */ | |
| export function registerTimelineProvider(selector: DocumentSelector, provider: TimelineProvider): Disposable; | |
| } | |
| //#endregion |
- Make sure there is a command contributed to each timeline item for the on click action.
- Try making a provider take a while and make sure the view shows an indication of progress/loading
- Try updating provider data after initial load (using
onDidChange) and ensure the view is updated - For extra points, try setting
replaceabletotrueand then register a replacement provider using the samesource-- it should replace the existing one. Also try the same thing without settingreplaceable(or set tofalse) and the second registration should error out.
Notes
- The
DocumentSelectoras part of theregisterTimelineProvidercall isn't yet honored - You cannot (yet) attach context menus to timeline items
Activity
Tyriar commentedon Jan 28, 2020
I can't get the API to work. With the following ext code:
backed up gets logged but not provide:
Tyriar commentedon Jan 29, 2020
Tried again and still having problems, closing off as I'm blocked. Hopefully the root cause of the problem will surface before the API is stabilized.