vsCode refresh tree when adding new Item

I use the following code to show tree items,


The items which is shown in the tree is related to a file, if the file changed the number of the tree items should be changed accordingly , currently I’ve add the code of the file watcher and when debug it stops there (on the getChildren function when I'm changing the file) and I see that I’ve provided the new updated entries (in the code),however the tree doesn’t refreshed with the new data, any idea what am I missing here ? somehow the new updated data is not reflected in the tree.

 private _onDidChangeTreeData: vscode.EventEmitter<TreeItem | null> = new vscode.EventEmitter<TreeItem | null>();
  readonly onDidChangeTreeData: vscode.Event<TreeItem | null> = this

  private eeake: Promise<TreeItem[]> | undefined = undefined;
  private autoRefresh: boolean = true;

  constructor(private context: vscode.ExtensionContext) {
    this.autoRefresh = vscode.workspace

    let filePath = this.fileName;
    let fileWatcher = vscode.workspace.createFileSystemWatcher(filePath);
    fileWatcher.onDidChange(() => (this.eeake = this.getChildren()), this.refresh());

  refresh(): void {

  public async getChildren(task?: TreeItem): Promise<TreeItem[]> {
    let tasks = await vscode.tasks
      .fetchTasks({ type: “run” })
      .then(function (value) {
        return value;

    let entry: TreeItem[] = [];
    if (tasks.length !== 0) {
      for (var i = 0; i < tasks.length; i++) {
        entry[i] = new TreeItem(
            command: “sView.executeTask",
            title: "Execute",
            arguments: [tasks[i]]
    return entry;

  getTreeItem(task: TreeItem): vscode.TreeItem {
    return task;

class TreeItem extends vscode.TreeItem {
  type: string;
    type: string,
    label: string,
    collapsibleState: vscode.TreeItemCollapsibleState,
    command?: vscode.Command
  ) {
    super(label, collapsibleState);
    this.type = type;
    this.command = command;
    this.iconPath = getIcon();


if there is something missing please let me know and I add, Im really stuck with it.