microsoft/vscode-extension-samples

the json outline does not update when the .json file changes

cognominal opened this issue · 4 comments

Extension sample

tree-view-sample

VS Code version

1.92-insider

What went wrong?

the json outline does not update when the .json file changes or when the
the selection change in said file. In the later case it should select the correct item in the tree view.

I ran to the same problem and described it in :
https://stackoverflow.com/questions/78814016/can-someone-provide-a-simple-example-of-updating-on-a-treeview-on-a-change-selec

To make things more confusing, an undocumented configuration option named autorefresh is set to false in package.json. But setting it to true does not change anything despite it being tested.

the json outline does not update when the .json file changes

I see this working correctly. The json outline view changes when the active editor changes. 

or when the the selection change in said file. In the later case it should select the correct item in the tree view.

This is not a feature that the json outline sample provides, so it is expected that the tree doesn't update when the selection changes in the editor.

To make things more confusing, an undocumented configuration option named autorefresh is set to false in package.json. But setting it to true does not change anything despite it being tested.

I tried the setting, and it works. When auto refresh is turned on then the tree changes in response to file changes. I've added a description for the setting: #1068

As I said in stackoverflow, I write an AST Explorer vscode extension and like it to behave like https://astexplorer.net/.
That means that when moving the cursor to a new token in the editor,
the relevant info must be selected in the tree view. How do I do that ?

Also I asked an ancillary question about the behavior of the debugger I don't
understand. A symbol that is defined, treeview, does not appear as such in the WATCH view.

Thx for your help.

The problem with the watch view is a known one.
It has been filed as a vscode issue but it is dependant
on a problem with ts sourcemaps filed as a tscode issue.

As for updating the treeview, there is an example of treeview.reveal() in testView.ts#L11 that I probably used as a model. To no avail so far, with or without await. There are a lof of questions about treeview.reveal() in many places. Maybe I will find answers there.

The code beyond that should probably used as a model
microsoft/vscode#224705 (comment)