mirror of
https://github.com/WhatsApp/erlang-language-platform.git
synced 2025-12-23 12:26:48 +00:00
Add support for elp.debugSingle command
Summary: * Add a `elp.debugSingle` command, which will eventually be used by the ELP "debug" code lens to start a debugging session for a given testcase. Reviewed By: alanz Differential Revision: D68159114 fbshipit-source-id: f0c2396f40518b1dd590eea49c6b300265899d7a
This commit is contained in:
parent
9ca22ec50f
commit
71978c9c8b
3 changed files with 33 additions and 3 deletions
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
import * as vscode from 'vscode';
|
||||
import * as dapConfig from './dapConfig';
|
||||
import * as edbDebugger from './debugger';
|
||||
|
||||
export type Runnable = {
|
||||
label: string;
|
||||
|
|
@ -39,6 +40,15 @@ export function registerCommands(context: vscode.ExtensionContext) {
|
|||
},
|
||||
),
|
||||
);
|
||||
// elp.debugSingle
|
||||
context.subscriptions.push(
|
||||
vscode.commands.registerCommand(
|
||||
'elp.debugSingle',
|
||||
async (runnable: Runnable) => {
|
||||
await debugSingle(runnable);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function runSingle(runnable: Runnable): Thenable<vscode.TaskExecution> {
|
||||
|
|
@ -90,3 +100,23 @@ export function buildTask(
|
|||
const exec = new vscode.ProcessExecution(command, args, definition);
|
||||
return new vscode.Task(definition, vscode.TaskScope.Workspace, name, task_source, exec, []);
|
||||
}
|
||||
|
||||
export async function debugSingle(runnable: Runnable): Promise<void> {
|
||||
const debugConfiguration = {
|
||||
type: edbDebugger.DEBUG_TYPE,
|
||||
name: 'Erlang EDB',
|
||||
request: 'launch',
|
||||
launchCommand: {
|
||||
cwd: "${workspaceFolder}",
|
||||
command: "rebar3",
|
||||
arguments: [
|
||||
"ct",
|
||||
"--sname",
|
||||
"debuggee",
|
||||
runnable.args.args
|
||||
]
|
||||
},
|
||||
targetNode: 'debuggee'
|
||||
};
|
||||
await vscode.debug.startDebugging(undefined, debugConfiguration);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,4 +26,4 @@ export function withErlangInstallationPath(): string {
|
|||
export function command(): string {
|
||||
const dapConfig = vscode.workspace.getConfiguration(DAP_CONFIG);
|
||||
return dapConfig.get<string>('command') || '';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@
|
|||
import * as vscode from 'vscode';
|
||||
import * as dapConfig from './dapConfig';
|
||||
|
||||
const DEBUG_TYPE = 'erlang-edb';
|
||||
export const DEBUG_TYPE = 'erlang-edb';
|
||||
|
||||
interface EdbDebugConfiguration extends vscode.DebugConfiguration {
|
||||
export interface EdbDebugConfiguration extends vscode.DebugConfiguration {
|
||||
launchCommand: {
|
||||
command: string;
|
||||
arguments?: Array<string>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue