the TreeView is initially populated and the TreeView instantiated. the 'refresh' button invokes the custom refresh function to gather updated data. This new information is stored in context.globalState()
The ctmInfrastructureProvider.refresh(); does not update the TreeView. I've added the event listener as well.
export class CtmInfrastructureProvider implements vscode.TreeDataProvider<number> {
private _onDidChangeTreeData: vscode.EventEmitter<number | null> = new vscode.EventEmitter<number | null>();
readonly onDidChangeTreeData: vscode.Event<number | null> = this._onDidChangeTreeData.event;
.
.
.
constructor(private context: vscode.ExtensionContext) {
let ctmInfrastructureCacheTmp: any = context.globalState.get('ctmInfrastructureCache');
this.refresh();
}
.
.
.
}
Here are my refresh functions:
let ctmInfrastructureRefreshEntry = vscode.commands.registerCommand(
'ctm.infrastructure.refreshEntry',
async () => {
ctmInfrastructureDicsovery = discoverCtmInfrastructure(); context.globalState.update('ctmInfrastructureCache',JSON.parse(ctmInfrastructureDicsovery));
ctmInfrastructureProvider.refresh();
}
);
context.subscriptions.push(ctmInfrastructureRefreshEntry);
The TreeDataProvider refresh()
refresh(offset?: number): void {
this.parseTree();
}
private parseTree(): void {
this.text = this.ctmInfrastructureCache;
this.tree = json.parseTree(this.ctmInfrastructureCache);
}
What am I missing?