提交 56d225bc 编写于 作者: S Sandeep Somavarapu

Fix #31606

上级 82d05385
......@@ -8,6 +8,7 @@ import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
export default {
MARKERS_PANEL_ID: 'workbench.panel.markers',
MARKER_COPY_ACTION_ID: 'problems.action.copy',
MARKER_COPY_MESSAGE_ACTION_ID: 'problems.action.copyMessage',
MARKER_OPEN_SIDE_ACTION_ID: 'problems.action.openToSide',
MarkerFocusContextKey: new RawContextKey<boolean>('problemFocus', false)
......
......@@ -34,6 +34,17 @@ export function registerContributions(): void {
when: Constants.MarkerFocusContextKey
}
});
registerAction({
id: Constants.MARKER_COPY_MESSAGE_ACTION_ID,
title: localize('copyMarkerMessage', "Copy Message"),
handler(accessor) {
copyMessage(accessor.get(IPanelService));
},
menu: {
menuId: MenuId.ProblemsPanelContext,
when: Constants.MarkerFocusContextKey
}
});
}
function copyMarker(panelService: IPanelService) {
......@@ -46,6 +57,16 @@ function copyMarker(panelService: IPanelService) {
}
}
function copyMessage(panelService: IPanelService) {
const activePanel = panelService.getActivePanel();
if (activePanel instanceof MarkersPanel) {
const element = (<MarkersPanel>activePanel).getFocusElement();
if (element instanceof Marker) {
clipboard.writeText(element.marker.message);
}
}
}
interface IActionDescriptor {
id: string;
handler: ICommandHandler;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册