提交 14249ad9 编写于 作者: I isidor

debug: "Add Log Point..." in command service

fixes #46136
上级 ddfab626
......@@ -10,7 +10,7 @@ import { Range } from 'vs/editor/common/core/range';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { ServicesAccessor, registerEditorAction, EditorAction, EditorCommand, registerEditorCommand } from 'vs/editor/browser/editorExtensions';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { IDebugService, CONTEXT_IN_DEBUG_MODE, CONTEXT_NOT_IN_DEBUG_REPL, CONTEXT_DEBUG_STATE, State, REPL_ID, VIEWLET_ID, IDebugEditorContribution, EDITOR_CONTRIBUTION_ID, CONTEXT_BREAKPOINT_WIDGET_VISIBLE } from 'vs/workbench/parts/debug/common/debug';
import { IDebugService, CONTEXT_IN_DEBUG_MODE, CONTEXT_NOT_IN_DEBUG_REPL, CONTEXT_DEBUG_STATE, State, REPL_ID, VIEWLET_ID, IDebugEditorContribution, EDITOR_CONTRIBUTION_ID, CONTEXT_BREAKPOINT_WIDGET_VISIBLE, BreakpointWidgetContext } from 'vs/workbench/parts/debug/common/debug';
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
......@@ -70,6 +70,27 @@ class ConditionalBreakpointAction extends EditorAction {
}
}
class LogPointAction extends EditorAction {
constructor() {
super({
id: 'editor.debug.action.logPoint',
label: nls.localize('logPointEditorAction', "Debug: Add Log Point..."),
alias: 'Debug: Add Log Point...',
precondition: null
});
}
public run(accessor: ServicesAccessor, editor: ICodeEditor): void {
const debugService = accessor.get(IDebugService);
const { lineNumber, column } = editor.getPosition();
if (debugService.getConfigurationManager().canSetBreakpointsIn(editor.getModel())) {
editor.getContribution<IDebugEditorContribution>(EDITOR_CONTRIBUTION_ID).showBreakpointWidget(lineNumber, column, BreakpointWidgetContext.LOG_MESSAGE);
}
}
}
class RunToCursorAction extends EditorAction {
constructor() {
......@@ -211,6 +232,7 @@ class CloseBreakpointWidgetCommand extends EditorCommand {
registerEditorAction(ToggleBreakpointAction);
registerEditorAction(ConditionalBreakpointAction);
registerEditorAction(LogPointAction);
registerEditorAction(RunToCursorAction);
registerEditorAction(SelectionToReplAction);
registerEditorAction(SelectionToWatchExpressionsAction);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册