I am writing a ts AST explorer which show an AST treeview for AST files. It correctly update the .ast file editor selection to reflect click on the treeview.
I would like to work the other way around.
I would like to update
the treeview to select the current token when the editor selection change.
I tried to do so by calling treeview.reveal()
in https://github.com/cognominal/ts-ast-explorer/blob/main/src/eventHandlers.ts#L48
An ancillary question comes when I tried to debug the instrumented code. The debugger stops on the if clause where the treeview
is true but the watch section of the debugger says it is undefined. How come ?
treeview.reveal()
has no effect.
The treeview extension sample is not realistic and does not give example of update on a selection change.
the first image show the extension in action
The second image shows the debugger with the watch section “pretending” treeview
is not defined