@@ -141,8 +141,14 @@ export class LiveWatchTreeDataProvider implements vscode.TreeDataProvider<LiveWa
141141 const modifyCommand = vscode . commands . registerCommand ( 'vscode-cmsis-debugger.liveWatch.modify' , async ( node ) => await this . registerRenameCommand ( node ) ) ;
142142 const copyCommand = vscode . commands . registerCommand ( 'vscode-cmsis-debugger.liveWatch.copy' , async ( node ) => { await this . registerCopyCommand ( node ) ; } ) ;
143143 const addToLiveWatchCommand = vscode . commands . registerCommand ( 'vscode-cmsis-debugger.liveWatch.addToLiveWatchFromTextEditor' , async ( ) => { await this . registerAddFromSelectionCommand ( ) ; } ) ;
144- const addToLiveWatchFromWatchWindowCommand = vscode . commands . registerCommand ( 'vscode-cmsis-debugger.liveWatch.addToLiveWatchFromWatchWindow' , async ( expression ) => { await this . registerAddToLiveWatchFromWatchWindow ( expression ) ; } ) ;
145- const addToLiveWatchFromVariablesViewCommand = vscode . commands . registerCommand ( 'vscode-cmsis-debugger.liveWatch.addToLiveWatchFromVariablesView' , async ( payload : { container : DebugProtocol . Scope ; variable : DebugProtocol . Variable ; } ) => { await this . registerAddToLiveWatchFromVariablesView ( payload ) ; } ) ;
144+ /* I am using the same callback function for both watch window and variables view, as they have the same payload structure for now.
145+ However, I believe the payload structure will change for the watch window in the future as the developer who created the PR for contributing to watch window context menu
146+ mentioned he used variables' window payload structure for simplicity.
147+ Find the PR here:
148+ https://github.com/microsoft/vscode/pull/237751
149+ */
150+ const addToLiveWatchFromWatchWindowCommand = vscode . commands . registerCommand ( 'vscode-cmsis-debugger.liveWatch.addToLiveWatchFromWatchWindow' , async ( payload : { container : DebugProtocol . Scope ; variable : DebugProtocol . Variable ; } ) => { await this . registerAddToLiveWatchFromVariablesView ( payload ) ; } ) ;
151+ const addToLiveWatchFromVariablesViewCommand = vscode . commands . registerCommand ( 'vscode-cmsis-debugger.liveWatch.addToLiveWatchFromVariablesView' , async ( payload : { container : DebugProtocol . Scope ; variable : DebugProtocol . Variable ; } ) => { await this . registerAddToLiveWatchFromVariablesView ( payload ) ; } ) ;
146152 this . _context . subscriptions . push ( registerLiveWatchView ,
147153 addCommand ,
148154 deleteAllCommand , deleteCommand , refreshCommand , modifyCommand , copyCommand , addToLiveWatchCommand , addToLiveWatchFromWatchWindowCommand , addToLiveWatchFromVariablesViewCommand ) ;
@@ -201,13 +207,6 @@ export class LiveWatchTreeDataProvider implements vscode.TreeDataProvider<LiveWa
201207 await this . addToRoots ( selectedText ) ;
202208 }
203209
204- private async registerAddToLiveWatchFromWatchWindow ( expression : any ) {
205- if ( ! expression ) {
206- return ;
207- }
208- await this . addToRoots ( expression . variable . name ) ;
209- }
210-
211210 private async registerAddToLiveWatchFromVariablesView ( payload : { container : DebugProtocol . Scope ; variable : DebugProtocol . Variable ; } ) {
212211 if ( ! payload || ! payload . variable ) {
213212 return ;
0 commit comments