Skip to content

Commit b0c1895

Browse files
committed
adjusting handler function names
1 parent 499ceb3 commit b0c1895

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

src/views/live-watch/live-watch.ts

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -134,26 +134,26 @@ export class LiveWatchTreeDataProvider implements vscode.TreeDataProvider<LiveWa
134134

135135
private addVSCodeCommands() {
136136
const registerLiveWatchView = vscode.window.registerTreeDataProvider('cmsis-debugger.liveWatch', this);
137-
const addCommand = vscode.commands.registerCommand('vscode-cmsis-debugger.liveWatch.add', async () => await this.registerAddCommand());
138-
const deleteAllCommand = vscode.commands.registerCommand('vscode-cmsis-debugger.liveWatch.deleteAll', async () => await this.registerDeleteAllCommand());
139-
const deleteCommand = vscode.commands.registerCommand('vscode-cmsis-debugger.liveWatch.delete', async (node) => await this.registerDeleteCommand(node));
137+
const addCommand = vscode.commands.registerCommand('vscode-cmsis-debugger.liveWatch.add', async () => await this.handleAddCommand());
138+
const deleteAllCommand = vscode.commands.registerCommand('vscode-cmsis-debugger.liveWatch.deleteAll', async () => await this.handleDeleteAllCommand());
139+
const deleteCommand = vscode.commands.registerCommand('vscode-cmsis-debugger.liveWatch.delete', async (node) => await this.handleDeleteCommand(node));
140140
const refreshCommand = vscode.commands.registerCommand('vscode-cmsis-debugger.liveWatch.refresh', async () => await this.refresh());
141-
const modifyCommand = vscode.commands.registerCommand('vscode-cmsis-debugger.liveWatch.modify', async (node) => await this.registerRenameCommand(node));
142-
const copyCommand = vscode.commands.registerCommand('vscode-cmsis-debugger.liveWatch.copy', async (node) => await this.registerCopyCommand(node));
141+
const modifyCommand = vscode.commands.registerCommand('vscode-cmsis-debugger.liveWatch.modify', async (node) => await this.handleRenameCommand(node));
142+
const copyCommand = vscode.commands.registerCommand('vscode-cmsis-debugger.liveWatch.copy', async (node) => await this.handleCopyCommand(node));
143143
const addToLiveWatchCommand = vscode.commands.registerCommand('vscode-cmsis-debugger.liveWatch.addToLiveWatchFromTextEditor',
144-
async () => { await this.registerAddFromSelectionCommand(); });
144+
async () => await this.handleAddFromSelectionCommand());
145145
/* omarArm: I am using the same callback function for both watch window and variables view, as they have the same payload structure for now.
146146
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
147147
mentioned he used variables' window payload structure for simplicity.
148148
Find the PR here:
149149
https://github.com/microsoft/vscode/pull/237751
150150
*/
151151
const addToLiveWatchFromWatchWindowCommand = vscode.commands.registerCommand('vscode-cmsis-debugger.liveWatch.addToLiveWatchFromWatchWindow',
152-
async (payload: { container: DebugProtocol.Scope; variable: DebugProtocol.Variable; }) => await this.registerAddToLiveWatchFromVariablesView(payload));
152+
async (payload: { container: DebugProtocol.Scope; variable: DebugProtocol.Variable; }) => await this.handleAddToLiveWatchFromVariablesView(payload));
153153
const addToLiveWatchFromVariablesViewCommand = vscode.commands.registerCommand('vscode-cmsis-debugger.liveWatch.addToLiveWatchFromVariablesView',
154-
async (payload: { container: DebugProtocol.Scope; variable: DebugProtocol.Variable; }) => await this.registerAddToLiveWatchFromVariablesView(payload));
154+
async (payload: { container: DebugProtocol.Scope; variable: DebugProtocol.Variable; }) => await this.handleAddToLiveWatchFromVariablesView(payload));
155155
const showInMemoryInspectorCommand = vscode.commands.registerCommand('vscode-cmsis-debugger.liveWatch.showInMemoryInspector',
156-
async (node: LiveWatchNode) => await this.showInMemoryInspector(node));
156+
async (node: LiveWatchNode) => await this.handleShowInMemoryInspector(node));
157157
this._context.subscriptions.push(
158158
registerLiveWatchView,
159159
addCommand,
@@ -169,26 +169,26 @@ export class LiveWatchTreeDataProvider implements vscode.TreeDataProvider<LiveWa
169169
);
170170
}
171171

172-
private async registerAddCommand() {
172+
private async handleAddCommand() {
173173
const expression = await vscode.window.showInputBox({ prompt: 'Expression' });
174174
if (!expression) {
175175
return;
176176
}
177177
await this.addToRoots(expression);
178178
}
179179

180-
private async registerDeleteAllCommand() {
180+
private async handleDeleteAllCommand() {
181181
await this.clear();
182182
}
183183

184-
private async registerDeleteCommand(node: LiveWatchNode) {
184+
private async handleDeleteCommand(node: LiveWatchNode) {
185185
if (!node) {
186186
return;
187187
}
188188
await this.delete(node);
189189
}
190190

191-
private async registerRenameCommand(node: LiveWatchNode) {
191+
private async handleRenameCommand(node: LiveWatchNode) {
192192
if (!node) {
193193
return;
194194
}
@@ -199,14 +199,14 @@ export class LiveWatchTreeDataProvider implements vscode.TreeDataProvider<LiveWa
199199
await this.rename(node, expression);
200200
}
201201

202-
private async registerCopyCommand(node: LiveWatchNode) {
202+
private async handleCopyCommand(node: LiveWatchNode) {
203203
if(!node) {
204204
return;
205205
}
206206
await vscode.env.clipboard.writeText(node.expression);
207207
}
208208

209-
private async registerAddFromSelectionCommand() {
209+
private async handleAddFromSelectionCommand() {
210210
const editor = vscode.window.activeTextEditor;
211211
if (!editor) {
212212
return;
@@ -221,14 +221,14 @@ export class LiveWatchTreeDataProvider implements vscode.TreeDataProvider<LiveWa
221221
await this.addToRoots(selectedText);
222222
}
223223

224-
private async registerAddToLiveWatchFromVariablesView(payload: { container: DebugProtocol.Scope; variable: DebugProtocol.Variable;}) {
224+
private async handleAddToLiveWatchFromVariablesView(payload: { container: DebugProtocol.Scope; variable: DebugProtocol.Variable;}) {
225225
if (!payload || !payload.variable) {
226226
return;
227227
}
228228
await this.addToRoots(payload.variable.name);
229229
}
230230

231-
private async showInMemoryInspector(node: LiveWatchNode) {
231+
private async handleShowInMemoryInspector(node: LiveWatchNode) {
232232
if (!node) {
233233
return;
234234
}
@@ -251,8 +251,7 @@ export class LiveWatchTreeDataProvider implements vscode.TreeDataProvider<LiveWa
251251
memoryReference: `&(${node.expression})`
252252
}
253253
};
254-
const result = await vscode.commands.executeCommand('memory-inspector.show-variable', args);
255-
console.log(result);
254+
await vscode.commands.executeCommand('memory-inspector.show-variable', args);
256255
}
257256

258257
private async evaluate(expression: string): Promise<LiveWatchValue> {

0 commit comments

Comments
 (0)