Skip to content

Commit 9672899

Browse files
Merge pull request #72 from granitrocky/master
Update pipeTransport options to be more robust
2 parents 3ce4658 + b727954 commit 9672899

File tree

2 files changed

+41
-30
lines changed

2 files changed

+41
-30
lines changed

package.json

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2306,9 +2306,6 @@
23062306
"pipeTransport": {
23072307
"description": "%generateOptionsSchema.pipeTransport.description%",
23082308
"type": "object",
2309-
"required": [
2310-
"debuggerPath"
2311-
],
23122309
"default": {
23132310
"pipeCwd": "${workspaceFolder}",
23142311
"pipeProgram": "enter the fully qualified path for the pipe program name, for example '/usr/bin/ssh'",
@@ -2838,9 +2835,6 @@
28382835
"pipeTransport": {
28392836
"description": "%generateOptionsSchema.pipeTransport.description%",
28402837
"type": "object",
2841-
"required": [
2842-
"debuggerPath"
2843-
],
28442838
"default": {
28452839
"pipeCwd": "${workspaceFolder}",
28462840
"pipeProgram": "enter the fully qualified path for the pipe program name, for example '/usr/bin/ssh'",
@@ -3646,9 +3640,6 @@
36463640
"pipeTransport": {
36473641
"description": "%generateOptionsSchema.pipeTransport.description%",
36483642
"type": "object",
3649-
"required": [
3650-
"debuggerPath"
3651-
],
36523643
"default": {
36533644
"pipeCwd": "${workspaceFolder}",
36543645
"pipeProgram": "enter the fully qualified path for the pipe program name, for example '/usr/bin/ssh'",
@@ -4178,9 +4169,6 @@
41784169
"pipeTransport": {
41794170
"description": "%generateOptionsSchema.pipeTransport.description%",
41804171
"type": "object",
4181-
"required": [
4182-
"debuggerPath"
4183-
],
41844172
"default": {
41854173
"pipeCwd": "${workspaceFolder}",
41864174
"pipeProgram": "enter the fully qualified path for the pipe program name, for example '/usr/bin/ssh'",

src/coreclrDebug/activate.ts

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -283,28 +283,14 @@ export class DebugAdapterExecutableFactory implements vscode.DebugAdapterDescrip
283283
// debugger has finished installation, kick off our debugger process
284284

285285
// use the executable specified in the package.json if it exists or determine it based on some other information (e.g. the session)
286-
if (!executable) {
287-
const dotNetInfo = await getDotnetInfo(omnisharpOptions.dotNetCliPaths);
288-
const pipeTransport = _session.configuration.pipeTransport;
289-
let command = '';
290-
let args = ['--interpreter=vscode'];
291-
if (typeof pipeTransport === 'object') {
292-
command = pipeTransport.debuggerPath;
293-
args = pipeTransport.pipeArgs;
294-
} else {
295-
command = path.join(
296-
common.getExtensionPath(),
297-
'.debugger',
298-
'netcoredbg',
299-
'netcoredbg' + CoreClrDebugUtil.getPlatformExeExtension()
300-
);
301-
}
302-
286+
const pipeTransport = _session.configuration.pipeTransport;
287+
if (!executable || typeof pipeTransport === 'object') {
303288
// Look to see if DOTNET_ROOT is set, then use dotnet cli path
289+
const dotNetInfo = await getDotnetInfo(omnisharpOptions.dotNetCliPaths);
304290
const dotnetRoot: string =
305291
process.env.DOTNET_ROOT ?? (dotNetInfo.CliPath ? path.dirname(dotNetInfo.CliPath) : '');
306292

307-
let options: vscode.DebugAdapterExecutableOptions | undefined = undefined;
293+
let options: vscode.DebugAdapterExecutableOptions = {};
308294
if (dotnetRoot) {
309295
options = {
310296
env: {
@@ -313,6 +299,43 @@ export class DebugAdapterExecutableFactory implements vscode.DebugAdapterDescrip
313299
};
314300
}
315301

302+
let command = '';
303+
let args = [];
304+
if (typeof pipeTransport === 'object') {
305+
if (pipeTransport.debuggerPath) {
306+
command = pipeTransport.debuggerPath;
307+
} else {
308+
command = path.join(
309+
common.getExtensionPath(),
310+
'.debugger',
311+
'netcoredbg',
312+
'netcoredbg' + CoreClrDebugUtil.getPlatformExeExtension()
313+
);
314+
}
315+
if (pipeTransport.debuggerArgs) {
316+
args = pipeTransport.debuggerArgs;
317+
} else {
318+
args.push('--interpreter=vscode', '--');
319+
}
320+
if (pipeTransport.pipeProgram) {
321+
args.push(pipeTransport.pipeProgram);
322+
}
323+
if (pipeTransport.pipeArgs) {
324+
args.push(pipeTransport.pipeArgs);
325+
}
326+
if (pipeTransport.pipeCwd) {
327+
options.cwd = pipeTransport.pipeCwd;
328+
}
329+
} else {
330+
command = path.join(
331+
common.getExtensionPath(),
332+
'.debugger',
333+
'netcoredbg',
334+
'netcoredbg' + CoreClrDebugUtil.getPlatformExeExtension()
335+
);
336+
args = ['--interpreter=vscode'];
337+
}
338+
316339
executable = new vscode.DebugAdapterExecutable(command, args, options);
317340
}
318341

0 commit comments

Comments
 (0)