Reloading specific treeview items

Can anyone provide any insight into how to update a specific tree view item without reloading the entire tree view? More specifically, I’m not quite sure how to update the data in the dataProvider once it becomes part of the TreeView object and then have that change reflected in the sidebar tree view.

For example, the TODO extension uses the following code, which works.

dataProvider = new ToDoDataProvider();

 treeView = new TreeView("todo", {
    dataProvider: dataProvider,

However, I can’t find a way to reload only the changes instead of the entire tree view.

dataProvider.loadData(); // The tree item data changes here.

  According to the docs,,
  it is possible to reload a specific element, which I would assume to mean the array 
  element (0, 1, 2... etc).

Perhaps i’m not understanding how to properly modify what is inside the dataProvider once it becomes part of the TreeView object. Should I be modifying that directly inside the treeView object? Or, is it always pointing to the original dataProvider object? And, how then do I reload only the element that changed? Passing an element treeView.reload(0), for example, seems to have no effect.

If it’s helpful, the related code should be in the main.js file at nova-todo/main.js at main · jasonplatts/nova-todo · GitHub (lines 14-19 and lines 120-125).

Thanks for any help!


treeView.reload(); seem to accept array of elements like . [elementOne, elementTwo] which will reload both of them.

Since you want to reload the element that changed… why not use the following handlers to fetch the element and then passed to the reload function? In theory it should work

treeView.onDidExpandElement((element) => {
    console.log("Expanded: " +;

treeView.onDidCollapseElement((element) => {
    console.log("Collapsed: " +;

treeView.onDidChangeVisibility(() => {
    console.log("Visibility Changed");

Thanks for taking the time to reply @clear.

I can see how those event listeners return an element from the tree view (a tree item). However, what I really want to do is make a change based on an external event. In this case when a file watch event is triggered and a change to the tags inside that file is detected. If I understand correctly, the Nova TreeView object wouldn’t know what element to provide because that information isn’t coming from the sidebar selection, visibility change, etc.

I think this post from @apexskier describes a similar situation.

TreeView reloading

Yeah, I think this is exactly the same issue as I have.

I thought it might. Thanks @apexskier.

@logan can you confirm this current API limitation?