@@ -6,7 +6,7 @@ import { DisplayStyle, variableDescription, variableBitIndices, memoryRowIndices
66import { CXXRTLDebugger } from '../debugger' ;
77import { Observer } from '../debug/observer' ;
88import { Designation , MemoryRangeDesignation , MemoryRowDesignation , ScalarDesignation } from '../model/sample' ;
9- import { IWatchItem , watchList } from '../debug/watch' ;
9+ import { IWatchItem , globalWatchList } from '../debug/watch' ;
1010import { Session } from '../debug/session' ;
1111
1212abstract class TreeItem {
@@ -37,7 +37,7 @@ class BitTreeItem extends TreeItem {
3737 provider : TreeDataProvider ,
3838 readonly designation : ScalarDesignation | MemoryRowDesignation ,
3939 readonly bitIndex : number ,
40- readonly contextValue ? : string ,
40+ readonly contextValue : string = '' ,
4141 ) {
4242 super ( provider ) ;
4343 }
@@ -81,7 +81,7 @@ class ScalarTreeItem extends TreeItem {
8181 constructor (
8282 provider : TreeDataProvider ,
8383 readonly designation : ScalarDesignation | MemoryRowDesignation ,
84- readonly contextValue ? : string ,
84+ readonly contextValue : string = '' ,
8585 ) {
8686 super ( provider ) ;
8787 }
@@ -127,7 +127,7 @@ class ArrayTreeItem extends TreeItem {
127127 constructor (
128128 provider : TreeDataProvider ,
129129 readonly designation : MemoryRangeDesignation ,
130- readonly contextValue ? : string ,
130+ readonly contextValue : string = '' ,
131131 ) {
132132 super ( provider ) ;
133133 }
@@ -197,10 +197,11 @@ class ScopeTreeItem extends TreeItem {
197197 }
198198 for ( const variable of await this . scope . variables ) {
199199 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' ) ) ;
201202 }
202203 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 ' ) ) ;
204205 }
205206 }
206207 return children ;
@@ -215,7 +216,7 @@ class WatchTreeItem extends TreeItem {
215216 }
216217
217218 override async getTreeItem ( ) : Promise < vscode . TreeItem > {
218- if ( watchList . get ( ) . length > 0 ) {
219+ if ( globalWatchList . get ( ) . length > 0 ) {
219220 return new vscode . TreeItem ( 'Watch' , vscode . TreeItemCollapsibleState . Expanded ) ;
220221 } else {
221222 return new vscode . TreeItem ( 'Watch (empty)' ) ;
@@ -224,7 +225,7 @@ class WatchTreeItem extends TreeItem {
224225
225226 override async getChildren ( ) : Promise < TreeItem [ ] > {
226227 const children = [ ] ;
227- for ( const [ index , watchItem ] of watchList . get ( ) . entries ( ) ) {
228+ for ( const [ index , watchItem ] of globalWatchList . get ( ) . entries ( ) ) {
228229 const variable = await this . provider . getVariable ( watchItem . id ) ;
229230 if ( variable === null ) {
230231 continue ;
@@ -241,10 +242,11 @@ class WatchTreeItem extends TreeItem {
241242 }
242243 let treeItem ;
243244 if ( designation instanceof MemoryRangeDesignation ) {
244- treeItem = new ArrayTreeItem ( this . provider , designation , 'inWatchList' ) ;
245+ treeItem = new ArrayTreeItem ( this . provider , designation , 'inWatchList|canSetRadix ' ) ;
245246 } else if ( designation instanceof ScalarDesignation || designation instanceof MemoryRowDesignation ) {
246247 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' ) ;
248250 } else {
249251 treeItem = new BitTreeItem ( this . provider , designation , watchItem . bit , 'inWatchList' ) ;
250252 }
@@ -269,7 +271,8 @@ export class TreeDataProvider implements vscode.TreeDataProvider<TreeItem> {
269271
270272 constructor ( rtlDebugger : CXXRTLDebugger ) {
271273 vscode . workspace . onDidChangeConfiguration ( ( event ) => {
272- if ( event . affectsConfiguration ( 'rtlDebugger.displayStyle' ) ) {
274+ if ( event . affectsConfiguration ( 'rtlDebugger.displayStyle' ) ||
275+ event . affectsConfiguration ( 'rtlDebugger.variableOptions' ) ) {
273276 this . _onDidChangeTreeData . fire ( null ) ;
274277 }
275278 } ) ;
@@ -287,7 +290,7 @@ export class TreeDataProvider implements vscode.TreeDataProvider<TreeItem> {
287290 }
288291 this . _onDidChangeTreeData . fire ( null ) ;
289292 } ) ;
290- watchList . onDidChange ( ( _items ) => {
293+ globalWatchList . onDidChange ( ( _items ) => {
291294 if ( this . watchTreeItem !== null ) {
292295 this . _onDidChangeTreeData . fire ( this . watchTreeItem ) ;
293296 }
0 commit comments