import { ExtensionContext , TreeDataProvider , TreeItem , window , EventEmitter , Event } from 'vscode' ; import { CommentListEntry } from './comment-list-entry' ; import { ExportFactory } from './export-factory' ; export class CommentView { constructor ( private commentProvider ) { window . createTreeView ( 'code-review.list' , { treeDataProvider : this . commentProvider , showCollapseAll : true , } ) ; } } export class CommentsProvider implements TreeDataProvider < CommentListEntry > { private _onDidChangeTreeData : EventEmitter < CommentListEntry | undefined > = new EventEmitter < CommentListEntry | undefined > ( ) ; readonly onDidChangeTreeData : Event < CommentListEntry | undefined > = this . _onDidChangeTreeData . event ; constructor ( private context , private exportFactory ) { } refresh ( entry ? ) { this . _onDidChangeTreeData . fire ( entry ) ; } getTreeItem ( element ) { return element ; } getChildren ( element ? ) { if ( ! element ) { return this . exportFactory . getFilesContainingComments ( ) ; } else { return this . exportFactory . getComments ( element ) ; } } }