提交 c141d585 编写于 作者: I isidor

Support debug console output from extensions

fixes #20113
上级 b515e167
......@@ -458,6 +458,11 @@ export interface IDebugService {
*/
removeReplExpressions(): void;
/**
* Appends the passed string to the debug repl.
*/
logToRepl(value: string): void;
/**
* Adds a new watch expression and evaluates it against the debug adapter.
*/
......
......@@ -16,14 +16,14 @@ export function registerCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: '_workbench.startDebug',
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(0),
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
handler(accessor: ServicesAccessor, configurationOrName: any) {
const debugService = accessor.get(IDebugService);
if (!configurationOrName) {
configurationOrName = debugService.getViewModel().selectedConfigurationName;
}
return debugService.createProcess(configurationOrName);
debugService.createProcess(configurationOrName).done(undefined, errors.onUnexpectedError);
},
when: CONTEXT_NOT_IN_DEBUG_MODE,
primary: undefined
......@@ -31,19 +31,30 @@ export function registerCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'workbench.customDebugRequest',
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(0),
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
handler(accessor: ServicesAccessor, request: string, requestArgs: any) {
const process = accessor.get(IDebugService).getViewModel().focusedProcess;
if (process) {
return process.session.custom(request, requestArgs);
process.session.custom(request, requestArgs).done(undefined, errors.onUnexpectedError);
}
return undefined;
},
when: CONTEXT_IN_DEBUG_MODE,
primary: undefined
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'debug.logToDebugConsole',
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
handler(accessor: ServicesAccessor, value: string) {
if (typeof value === 'string') {
const debugService = accessor.get(IDebugService);
debugService.logToRepl(value);
}
},
when: undefined,
primary: undefined
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'debug.toggleBreakpoint',
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(5),
......
......@@ -535,6 +535,10 @@ export class DebugService implements debug.IDebugService {
this.model.removeReplExpressions();
}
public logToRepl(value: string): void {
this.model.appendToRepl(value, severity.Info);
}
public addWatchExpression(name: string): TPromise<void> {
return this.model.addWatchExpression(this.viewModel.focusedProcess, this.viewModel.focusedStackFrame, name);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册