@@ -6,7 +6,7 @@ import { DisplayStyle, variableDescription, variableBitIndices, memoryRowIndices
6
6
import { CXXRTLDebugger } from '../debugger' ;
7
7
import { Observer } from '../debug/observer' ;
8
8
import { Designation , MemoryRangeDesignation , MemoryRowDesignation , ScalarDesignation } from '../model/sample' ;
9
- import { IWatchItem , watchList } from '../debug/watch' ;
9
+ import { IWatchItem , globalWatchList } from '../debug/watch' ;
10
10
import { Session } from '../debug/session' ;
11
11
12
12
abstract class TreeItem {
@@ -37,7 +37,7 @@ class BitTreeItem extends TreeItem {
37
37
provider : TreeDataProvider ,
38
38
readonly designation : ScalarDesignation | MemoryRowDesignation ,
39
39
readonly bitIndex : number ,
40
- readonly contextValue ? : string ,
40
+ readonly contextValue : string = '' ,
41
41
) {
42
42
super ( provider ) ;
43
43
}
@@ -81,7 +81,7 @@ class ScalarTreeItem extends TreeItem {
81
81
constructor (
82
82
provider : TreeDataProvider ,
83
83
readonly designation : ScalarDesignation | MemoryRowDesignation ,
84
- readonly contextValue ? : string ,
84
+ readonly contextValue : string = '' ,
85
85
) {
86
86
super ( provider ) ;
87
87
}
@@ -127,7 +127,7 @@ class ArrayTreeItem extends TreeItem {
127
127
constructor (
128
128
provider : TreeDataProvider ,
129
129
readonly designation : MemoryRangeDesignation ,
130
- readonly contextValue ? : string ,
130
+ readonly contextValue : string = '' ,
131
131
) {
132
132
super ( provider ) ;
133
133
}
@@ -197,10 +197,11 @@ class ScopeTreeItem extends TreeItem {
197
197
}
198
198
for ( const variable of await this . scope . variables ) {
199
199
if ( variable instanceof ScalarVariable ) {
200
- children . push ( new ScalarTreeItem ( this . provider , variable . designation ( ) , 'canWatch' ) ) ;
200
+ children . push ( new ScalarTreeItem ( this . provider , variable . designation ( ) ,
201
+ variable . width > 1 ? 'canWatch|canSetRadix' : 'canWatch' ) ) ;
201
202
}
202
203
if ( variable instanceof MemoryVariable ) {
203
- children . push ( new ArrayTreeItem ( this . provider , variable . designation ( ) , 'canWatch' ) ) ;
204
+ children . push ( new ArrayTreeItem ( this . provider , variable . designation ( ) , 'canWatch|canSetRadix ' ) ) ;
204
205
}
205
206
}
206
207
return children ;
@@ -215,7 +216,7 @@ class WatchTreeItem extends TreeItem {
215
216
}
216
217
217
218
override async getTreeItem ( ) : Promise < vscode . TreeItem > {
218
- if ( watchList . get ( ) . length > 0 ) {
219
+ if ( globalWatchList . get ( ) . length > 0 ) {
219
220
return new vscode . TreeItem ( 'Watch' , vscode . TreeItemCollapsibleState . Expanded ) ;
220
221
} else {
221
222
return new vscode . TreeItem ( 'Watch (empty)' ) ;
@@ -224,7 +225,7 @@ class WatchTreeItem extends TreeItem {
224
225
225
226
override async getChildren ( ) : Promise < TreeItem [ ] > {
226
227
const children = [ ] ;
227
- for ( const [ index , watchItem ] of watchList . get ( ) . entries ( ) ) {
228
+ for ( const [ index , watchItem ] of globalWatchList . get ( ) . entries ( ) ) {
228
229
const variable = await this . provider . getVariable ( watchItem . id ) ;
229
230
if ( variable === null ) {
230
231
continue ;
@@ -241,10 +242,11 @@ class WatchTreeItem extends TreeItem {
241
242
}
242
243
let treeItem ;
243
244
if ( designation instanceof MemoryRangeDesignation ) {
244
- treeItem = new ArrayTreeItem ( this . provider , designation , 'inWatchList' ) ;
245
+ treeItem = new ArrayTreeItem ( this . provider , designation , 'inWatchList|canSetRadix ' ) ;
245
246
} else if ( designation instanceof ScalarDesignation || designation instanceof MemoryRowDesignation ) {
246
247
if ( watchItem . bit === undefined ) {
247
- treeItem = new ScalarTreeItem ( this . provider , designation , 'inWatchList' ) ;
248
+ treeItem = new ScalarTreeItem ( this . provider , designation ,
249
+ designation . variable . width > 1 ? 'inWatchList|canSetRadix' : 'inWatchList' ) ;
248
250
} else {
249
251
treeItem = new BitTreeItem ( this . provider , designation , watchItem . bit , 'inWatchList' ) ;
250
252
}
@@ -269,7 +271,8 @@ export class TreeDataProvider implements vscode.TreeDataProvider<TreeItem> {
269
271
270
272
constructor ( rtlDebugger : CXXRTLDebugger ) {
271
273
vscode . workspace . onDidChangeConfiguration ( ( event ) => {
272
- if ( event . affectsConfiguration ( 'rtlDebugger.displayStyle' ) ) {
274
+ if ( event . affectsConfiguration ( 'rtlDebugger.displayStyle' ) ||
275
+ event . affectsConfiguration ( 'rtlDebugger.variableOptions' ) ) {
273
276
this . _onDidChangeTreeData . fire ( null ) ;
274
277
}
275
278
} ) ;
@@ -287,7 +290,7 @@ export class TreeDataProvider implements vscode.TreeDataProvider<TreeItem> {
287
290
}
288
291
this . _onDidChangeTreeData . fire ( null ) ;
289
292
} ) ;
290
- watchList . onDidChange ( ( _items ) => {
293
+ globalWatchList . onDidChange ( ( _items ) => {
291
294
if ( this . watchTreeItem !== null ) {
292
295
this . _onDidChangeTreeData . fire ( this . watchTreeItem ) ;
293
296
}
0 commit comments