Repository navigation
Closed
Labels
Description
Testing #91330
I made a simple provider, but none of the timeline events show up. The timeline view says that there is no timeline for the file, and when I hit refresh, it says that the timeline is loading.
There is this error in the console:
ERR Cannot read property 'map' of undefined: TypeError: Cannot read property 'map' of undefined
at Object.provideTimeline (c:\Users\alros\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:660:139)
My simple extension:
export class TimelineProvider implements vscode.TimelineProvider {
private static items: vscode.TimelineItem[] = [];
private _onDidChange = new vscode.EventEmitter<vscode.TimelineChangeEvent>();
get onDidChange(): vscode.Event<vscode.TimelineChangeEvent> {
return this._onDidChange.event;
}
readonly id = 'counting-timeline-provider';
readonly label = 'Let\s count';
constructor() {
setInterval(() => {
const item: vscode.TimelineItem = new vscode.TimelineItem('item ' + TimelineProvider.items.length, new Date().getTime());
item.command = { title: 'Toggle', command: 'workbench.action.toggleDevTools' };
item.description = 'This is the description of ' + TimelineProvider.items.length;
TimelineProvider.items.push(item);
this._onDidChange.fire();
}, 4000);
}
async provideTimeline(uri: vscode.Uri, token: vscode.CancellationToken): Promise<vscode.TimelineItem[]> {
return TimelineProvider.items;
}
}
Activity
eamodio commentedon Feb 26, 2020
Alex Ross (@alexr00) It doesn't look like you aren't using the up-to-date d.ts -- because you can't just return an array from
provideTimelineanymore.