@@ -34,7 +34,7 @@ export class LiveWatchTreeDataProvider implements vscode.TreeDataProvider<LiveWa
3434 private roots : LiveWatchNode [ ] = [ ] ;
3535 private nodeID : number ;
3636 private _context : vscode . ExtensionContext ;
37- private activeSession : GDBTargetDebugSession | undefined ;
37+ private _activeSession : GDBTargetDebugSession | undefined ;
3838
3939 constructor ( private readonly context : vscode . ExtensionContext ) {
4040 this . roots = this . context . workspaceState . get < LiveWatchNode [ ] > ( this . STORAGE_KEY ) ?? [ ] ;
@@ -53,12 +53,16 @@ export class LiveWatchTreeDataProvider implements vscode.TreeDataProvider<LiveWa
5353 }
5454
5555 public getTreeItem ( element : LiveWatchNode ) : vscode . TreeItem {
56- const item = new vscode . TreeItem ( element . expression , vscode . TreeItemCollapsibleState . None ) ;
56+ const item = new vscode . TreeItem ( element . expression + ' = ' , vscode . TreeItemCollapsibleState . None ) ;
5757 item . description = element . value || '' ;
5858 item . contextValue = 'expression' ;
5959 return item ;
6060 }
6161
62+ public get activeSession ( ) : GDBTargetDebugSession | undefined {
63+ return this . _activeSession ;
64+ }
65+
6266 public async activate ( tracker : GDBTargetDebugTracker ) : Promise < void > {
6367 this . addVSCodeCommands ( ) ;
6468 const onDidChangeActiveDebugSession = tracker . onDidChangeActiveDebugSession ( async ( session ) => await this . handleOnDidChangeActiveDebugSession ( session ) ) ;
@@ -69,7 +73,7 @@ export class LiveWatchTreeDataProvider implements vscode.TreeDataProvider<LiveWa
6973 const onStackTrace = tracker . onDidChangeActiveStackItem ( async ( ) => await this . refresh ( ) ) ;
7074 // Clearing active session on closing the session
7175 const onWillStopSession = tracker . onWillStopSession ( async ( session ) => {
72- this . activeSession = session ;
76+ this . _activeSession = session ;
7377 await this . refresh ( ) ;
7478 await this . save ( ) ;
7579 } ) ;
@@ -90,13 +94,13 @@ export class LiveWatchTreeDataProvider implements vscode.TreeDataProvider<LiveWa
9094 }
9195
9296 private async handleOnDidChangeActiveDebugSession ( session : GDBTargetDebugSession | undefined ) : Promise < void > {
93- this . activeSession = session ;
97+ this . _activeSession = session ;
9498 await this . refresh ( ) ;
9599 }
96100
97101 private async handleOnWillStartSession ( session : GDBTargetDebugSession ) : Promise < void > {
98102 session . refreshTimer . onRefresh ( async ( refreshSession ) => {
99- this . activeSession = refreshSession ;
103+ this . _activeSession = refreshSession ;
100104 await this . refresh ( ) ;
101105 } ) ;
102106 }
@@ -144,10 +148,10 @@ export class LiveWatchTreeDataProvider implements vscode.TreeDataProvider<LiveWa
144148 }
145149
146150 private async evaluate ( expression : string ) : Promise < string > {
147- if ( ! this . activeSession ) {
151+ if ( ! this . _activeSession ) {
148152 return 'No active session' ;
149153 }
150- const result = await this . activeSession . evaluateGlobalExpression ( expression ) ;
154+ const result = await this . _activeSession . evaluateGlobalExpression ( expression , 'watch' ) ;
151155 return result ;
152156 }
153157
@@ -187,14 +191,14 @@ export class LiveWatchTreeDataProvider implements vscode.TreeDataProvider<LiveWa
187191
188192 private async refresh ( node ?: LiveWatchNode ) {
189193 if ( node ) {
190- this . _onDidChangeTreeData . fire ( node ) ;
191194 node . value = await this . evaluate ( node . expression ) ;
195+ this . _onDidChangeTreeData . fire ( node ) ;
192196 return ;
193197 }
194- this . _onDidChangeTreeData . fire ( ) ;
195198 for ( const n of this . roots ) {
196199 n . value = await this . evaluate ( n . expression ) ;
197200 }
201+ this . _onDidChangeTreeData . fire ( ) ;
198202 }
199203
200204 private async save ( ) {
0 commit comments