@@ -44,28 +44,7 @@ export class ComponentViewerTreeDataProvider implements vscode.TreeDataProvider<
4444 this . _scvdModel = { scvdGuiOut : [ ] } ;
4545 }
4646 public async activate ( ) : Promise < void > {
47- //public async activate(tracker: GDBTargetDebugTracker): Promise<void> {
48- /*
49- // Subscribe to the debug tracker relevant events
50- const onDidChangeActiveDebugSessionDisposable = tracker.onDidChangeActiveDebugSession(
51- async (session) => await this.handleOnDidChangeActiveDebugSession(session)
52- );
53- const onWillStartSessionDisposable = tracker.onWillStartSession(
54- async (session) => await this.handleOnWillStartSession(session)
55- );
56- const onWillStopSessionDisposable = tracker.onWillStopSession(
57- async (session) => await this.handleOnWillStopSession(session)
58- );
59- const onDidChangeActiveStackItemDisposable = tracker.onDidChangeActiveStackItem(
60- async (stackFrame) => await this.handleOnDidChangeActiveStackItem(stackFrame)
61- );
62- // Extracts out data from objects inside of the scvd model
63- if (!this._scvdModel) {
64- console.warn('No SCVD model set in ComponentViewerTreeDataProvider');
65- return;
66- }
67- */
68- this . addRootObject ( ) ;
47+ await this . addRootObject ( ) ;
6948 this . refresh ( ) ;
7049 }
7150
@@ -78,6 +57,7 @@ export class ComponentViewerTreeDataProvider implements vscode.TreeDataProvider<
7857 // Needs fixing, getGuiValue() for ScvdNode returns 0 when undefined
7958 treeItem . description = element . getGuiValue ( ) ?? '' ;
8059 treeItem . tooltip = element . getGuiLineInfo ( ) ?? '' ;
60+ treeItem . id = ( element as unknown as { nodeId : string } ) . nodeId ;
8161 return treeItem ;
8262 }
8363
@@ -86,33 +66,19 @@ export class ComponentViewerTreeDataProvider implements vscode.TreeDataProvider<
8666 return Promise . resolve ( this . _objectOutRoots ) ;
8767 }
8868
89- return Promise . resolve ( element . getGuiChildren ( ) || [ ] ) ;
90- }
91- /*
92- private async handleOnDidChangeActiveDebugSession(session: GDBTargetDebugSession | undefined): Promise<void> {
93- // Handle changes to the active debug session if needed
94- this.refresh();
95- }
96-
97- private async handleOnWillStartSession(session: GDBTargetDebugSession): Promise<void> {
98- // Handle actions before a debug session starts if needed
99- this.refresh();
100- }
101-
102- private async handleOnWillStopSession(session: GDBTargetDebugSession): Promise<void> {
103- // Handle actions before a debug session stops if needed
104- this.refresh();
105- }
106-
107- private async handleOnDidChangeActiveStackItem(stackFrame: SessionStackItem): Promise<void> {
108- // Handle changes to the active stack frame if needed
109- this.refresh();
69+ const children = element . getGuiChildren ( ) || [ ] ;
70+ return Promise . resolve ( children ) ;
11071 }
111- */
72+
11273 private refresh ( ) : void {
11374 this . _onDidChangeTreeData . fire ( ) ;
11475 }
11576
77+ public resetModelCache ( ) : void {
78+ this . _scvdModel . scvdGuiOut = [ ] ;
79+ this . _objectOutRoots = [ ] ;
80+ }
81+
11682 public async addGuiOut ( guiOut : ScvdGuiInterface [ ] | undefined ) {
11783 if ( guiOut !== undefined ) {
11884 guiOut . forEach ( item => this . _scvdModel . scvdGuiOut . push ( item ) ) ;
@@ -134,8 +100,6 @@ export class ComponentViewerTreeDataProvider implements vscode.TreeDataProvider<
134100 if ( this . _scvdModel ?. scvdGuiOut . length === 0 ) {
135101 return ;
136102 }
137- this . _scvdModel . scvdGuiOut . forEach ( guiOut => {
138- this . _objectOutRoots . push ( guiOut ) ;
139- } ) ;
103+ this . _objectOutRoots = [ ...this . _scvdModel . scvdGuiOut ] ;
140104 }
141105}
0 commit comments