Skip to content

Commit 910dabe

Browse files
yogeshwaran-cclaude
andcommitted
feat(debug): add 'Copy All' action to Watch view context menu
Currently users can only copy individual watch expressions or values one at a time via the context menu. Selecting multiple rows with Ctrl+A and Copy only captures values (or a flat list), losing the Expression → Value mapping. This adds a new 'Copy All' context menu action that copies all watch expressions as name: value pairs, one per line — ready to paste into issues, chat messages, or notes when providing debugging context. Fixes #306116 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1da74cc commit 910dabe

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,3 +692,30 @@ registerAction2(class CopyExpression extends ViewAction<WatchExpressionsView> {
692692
}
693693
}
694694
});
695+
696+
export const COPY_ALL_WATCH_EXPRESSIONS_COMMAND_ID = 'workbench.debug.viewlet.action.copyAllWatchExpressions';
697+
698+
registerAction2(class CopyAllWatchExpressions extends ViewAction<WatchExpressionsView> {
699+
constructor() {
700+
super({
701+
id: COPY_ALL_WATCH_EXPRESSIONS_COMMAND_ID,
702+
title: localize('copyAllWatchExpressions', "Copy All"),
703+
f1: false,
704+
viewId: WATCH_VIEW_ID,
705+
precondition: CONTEXT_WATCH_EXPRESSIONS_EXIST,
706+
menu: {
707+
id: MenuId.DebugWatchContext,
708+
order: 45,
709+
group: '3_modification'
710+
}
711+
});
712+
}
713+
714+
runInView(accessor: ServicesAccessor): void {
715+
const clipboardService = accessor.get(IClipboardService);
716+
const debugService = accessor.get(IDebugService);
717+
const watches = debugService.getModel().getWatchExpressions();
718+
const lines = watches.map(w => `${w.name}: ${w.value}`);
719+
clipboardService.writeText(lines.join('\n'));
720+
}
721+
});

0 commit comments

Comments
 (0)