Skip to content

Commit

Permalink
Merge pull request #72 from granitrocky/master
Browse files Browse the repository at this point in the history
Update pipeTransport options to be more robust
  • Loading branch information
muhammadsammy authored Jun 20, 2024
2 parents 3ce4658 + b727954 commit 9672899
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 30 deletions.
12 changes: 0 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2306,9 +2306,6 @@
"pipeTransport": {
"description": "%generateOptionsSchema.pipeTransport.description%",
"type": "object",
"required": [
"debuggerPath"
],
"default": {
"pipeCwd": "${workspaceFolder}",
"pipeProgram": "enter the fully qualified path for the pipe program name, for example '/usr/bin/ssh'",
Expand Down Expand Up @@ -2838,9 +2835,6 @@
"pipeTransport": {
"description": "%generateOptionsSchema.pipeTransport.description%",
"type": "object",
"required": [
"debuggerPath"
],
"default": {
"pipeCwd": "${workspaceFolder}",
"pipeProgram": "enter the fully qualified path for the pipe program name, for example '/usr/bin/ssh'",
Expand Down Expand Up @@ -3646,9 +3640,6 @@
"pipeTransport": {
"description": "%generateOptionsSchema.pipeTransport.description%",
"type": "object",
"required": [
"debuggerPath"
],
"default": {
"pipeCwd": "${workspaceFolder}",
"pipeProgram": "enter the fully qualified path for the pipe program name, for example '/usr/bin/ssh'",
Expand Down Expand Up @@ -4178,9 +4169,6 @@
"pipeTransport": {
"description": "%generateOptionsSchema.pipeTransport.description%",
"type": "object",
"required": [
"debuggerPath"
],
"default": {
"pipeCwd": "${workspaceFolder}",
"pipeProgram": "enter the fully qualified path for the pipe program name, for example '/usr/bin/ssh'",
Expand Down
59 changes: 41 additions & 18 deletions src/coreclrDebug/activate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,28 +283,14 @@ export class DebugAdapterExecutableFactory implements vscode.DebugAdapterDescrip
// debugger has finished installation, kick off our debugger process

// use the executable specified in the package.json if it exists or determine it based on some other information (e.g. the session)
if (!executable) {
const dotNetInfo = await getDotnetInfo(omnisharpOptions.dotNetCliPaths);
const pipeTransport = _session.configuration.pipeTransport;
let command = '';
let args = ['--interpreter=vscode'];
if (typeof pipeTransport === 'object') {
command = pipeTransport.debuggerPath;
args = pipeTransport.pipeArgs;
} else {
command = path.join(
common.getExtensionPath(),
'.debugger',
'netcoredbg',
'netcoredbg' + CoreClrDebugUtil.getPlatformExeExtension()
);
}

const pipeTransport = _session.configuration.pipeTransport;
if (!executable || typeof pipeTransport === 'object') {
// Look to see if DOTNET_ROOT is set, then use dotnet cli path
const dotNetInfo = await getDotnetInfo(omnisharpOptions.dotNetCliPaths);
const dotnetRoot: string =
process.env.DOTNET_ROOT ?? (dotNetInfo.CliPath ? path.dirname(dotNetInfo.CliPath) : '');

let options: vscode.DebugAdapterExecutableOptions | undefined = undefined;
let options: vscode.DebugAdapterExecutableOptions = {};
if (dotnetRoot) {
options = {
env: {
Expand All @@ -313,6 +299,43 @@ export class DebugAdapterExecutableFactory implements vscode.DebugAdapterDescrip
};
}

let command = '';
let args = [];
if (typeof pipeTransport === 'object') {
if (pipeTransport.debuggerPath) {
command = pipeTransport.debuggerPath;
} else {
command = path.join(
common.getExtensionPath(),
'.debugger',
'netcoredbg',
'netcoredbg' + CoreClrDebugUtil.getPlatformExeExtension()
);
}
if (pipeTransport.debuggerArgs) {
args = pipeTransport.debuggerArgs;
} else {
args.push('--interpreter=vscode', '--');
}
if (pipeTransport.pipeProgram) {
args.push(pipeTransport.pipeProgram);
}
if (pipeTransport.pipeArgs) {
args.push(pipeTransport.pipeArgs);
}
if (pipeTransport.pipeCwd) {
options.cwd = pipeTransport.pipeCwd;
}
} else {
command = path.join(
common.getExtensionPath(),
'.debugger',
'netcoredbg',
'netcoredbg' + CoreClrDebugUtil.getPlatformExeExtension()
);
args = ['--interpreter=vscode'];
}

executable = new vscode.DebugAdapterExecutable(command, args, options);
}

Expand Down

0 comments on commit 9672899

Please sign in to comment.