Closed eamodio closed 4 years ago
My sample User data history timeline is here - https://github.com/sandy081/userdata-timeline-sample
I am half done on this.. pending (will continue tomorrow)
Edit: Pending
Edit: Done
I've a hard time getting setting up a timeline provider, below is as far as I could get from looking up various samples:
import * as vscode from 'vscode';
export class FirstTimelineProvider implements vscode.TimelineProvider {
onDidChange?: vscode.Event<vscode.TimelineChangeEvent> | undefined;
id = 'first-timeline';
label = 'First Timeline';
async provideTimeline(uri: vscode.Uri, options: vscode.TimelineOptions, token: vscode.CancellationToken): vscode.ProviderResult<vscode.Timeline> {
return Promise.resolve<vscode.Timeline>({
items: [
{
id: '1',
label: 'Fast Timeline1',
description: '',
timestamp: Date.now(),
},
{
id: '2',
label: 'Fast Timeline2',
description: '',
timestamp: Date.now() - 3000000000,
}
],
paging: {
cursor: 'next'
}
});
}
}
I'll likely defer this one to someone else.
My extension: https://github.com/JacksonKearl/vscode-solunar-timeline
Please test with multiple providers and ensure stable paging (via Load more) and display. Also test with excluding sources from display using the timeline.excludeSources setting (or ... menu includes on the Timeline view)
Paging seems to work fine, but the interface is a bit odd to work with. Proposal given in a separate issue.
I did not implement the "fetch entire timeline" as for my extension that doesn't make any sense (infinite timeline). This didn't seem to have any effect on the runtime. As mentioned elsewhere, I think it would be good to separate out these different capabilities into individual methods that extensions can selectively choose to implement and core can detect what is available and work around that.
Make sure there is a command contributed to each timeline item for the on click action.
π
Contribute a command to the timeline/item/context for specific timeline items
π
Try updating provider data after initial load (using onDidChange) and ensure the view is updated
π
Try using a TimelineChangeEvent with reset on/off
The purpose of reset isn't clear to me. In particular when you'd use reset: false
(the default).
Ensure that if you fire an onDidChange event while the Timeline view is hidden/collapsed, your provideTimeline method isn't called until the Timeline view is shown again
π
Aside:
I'd like to see future events better supported. Capping everything to the present seems artificially limiting. My extension is a bit esoteric sure, but I'd be inclined to make a real extension that, for instance, tells me how many days there are until code freeze/endgame. I think this could be simply implemented by mandating a fixed number of future events (no forward paging). Really the whole thing could remain as-is, just remove the cap on the rendered time.
Done. Good job @eamodio . Other than suggestions to the API Timeline view works flawlessly. π
Refs: #84297
Complexity: 4
Similar to #91330.
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 aUri
. Here is an example provider.Here is the current API declaration: https://github.com/microsoft/vscode/blob/21293c4266dbffa6397c13038295900b44989af2/src/vs/vscode.proposed.d.ts#L1788-L1941
For implementing paging follow the basic scenario guidelines here on how the provider will be called: https://github.com/microsoft/vscode/issues/84297#issuecomment-602762832
timeline.excludeSources
setting (or...
menu includes on the Timeline view)timeline/item/context
for specific timeline itemsonDidChange
) and ensure the view is updatedTimelineChangeEvent
withreset
on/offonDidChange
event while the Timeline view is hidden/collapsed, yourprovideTimeline
method isn't called until the Timeline view is shown again