Skip to content

Commit

Permalink
launch.json fixes for 'cwd' and '${command.' (#1282)
Browse files Browse the repository at this point in the history
This resolves:
#1275
#1083
  • Loading branch information
gregg-miskelly authored Mar 3, 2017
1 parent 74ecafc commit c32f17b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ There have been several fixes to the colorizer grammar resulting in much smoothe

* Support for Unity and Mono development on macOS and Linux has been restored! This release brings back support for the Mono version of OmniSharp, which is used to provide *much* better support for .csproj/.sln projects. Please note that Mono version 4.0.1 or newer is required.
* Generation of tasks.json and launch.json files can now properly handle nested projects. [#170](https://github.com/OmniSharp/omnisharp-vscode/issues/170)
* New UI that makes it easy to select a process ID when attaching the debugger to another process. Note: If you have an existing launch.json file, you can re-generate it by deleting the file, closing your workspace in Visual Studio Code and opening it again. Or, you can open the launch.json file and change the `processId` value to `"${command.pickProcess}"`.
* New UI that makes it easy to select a process ID when attaching the debugger to another process. Note: If you have an existing launch.json file, you can re-generate it by deleting the file, closing your workspace in Visual Studio Code and opening it again. Or, you can open the launch.json file and change the `processId` value to `"${command:pickProcess}"`.
* Support for debugging in .cshtml files. To enable this, add a `sourceFileMap` entry to your launch.json with the following content: `"sourceFileMap": { "/Views": "${workspaceRoot}/Views" }`
* Support for conditional breakpoints
* New support for changing variable values in the debugger! To try this, just right-click on the variable name and select 'Set Value'. Note: To properly support this feature, we've changed the display of variable type names in the debugger to a shortened form. The full type name can be viewed by hovering over the name with the mouse.
Expand Down
2 changes: 1 addition & 1 deletion debugger.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ The C# debugger supports attaching to processes. To do this, switch to the Debug

![Debug launch configuration drop down](https://raw.githubusercontent.com/wiki/OmniSharp/omnisharp-vscode/images/debug-launch-configurations.png)

Select the '.NET Core Attach' configuration. Clicking the play button (or pressing <kbd>F5</kbd>) will then try to attach. In launch.json, if `processId` is set to `"${command.pickProcess}"` this will provide UI to select which process to attach to.
Select the '.NET Core Attach' configuration. Clicking the play button (or pressing <kbd>F5</kbd>) will then try to attach. In launch.json, if `processId` is set to `"${command:pickProcess}"` this will provide UI to select which process to attach to.

#### Docker Support

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -878,12 +878,12 @@
"anyOf": [
{
"type": "string",
"description": "The process id to attach to. Use \"${command.pickProcesss}\" to get a list of running processes to attach to. If 'processId' used, 'processName' should not be used.",
"default": "${command.pickProcess}"
"description": "The process id to attach to. Use \"${command:pickProcesss}\" to get a list of running processes to attach to. If 'processId' used, 'processName' should not be used.",
"default": "${command:pickProcess}"
},
{
"type": "integer",
"description": "The process id to attach to. Use \"${command.pickProcesss}\" to get a list of running processes to attach to. If 'processId' used, 'processName' should not be used.",
"description": "The process id to attach to. Use \"${command:pickProcesss}\" to get a list of running processes to attach to. If 'processId' used, 'processName' should not be used.",
"default": 0
}
]
Expand Down Expand Up @@ -1162,7 +1162,7 @@
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command.pickProcess}"
"processId": "${command:pickProcess}"
}
]
}
Expand Down
21 changes: 18 additions & 3 deletions src/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,21 @@ export class AssetGenerator {
return result;
}

private computeWorkingDirectory() : string {
if (!this.hasProject) {
// If there's no target project data, use a placeholder for the path.
return '${workspaceRoot}';
}

let result = '${workspaceRoot}';

if (this.projectPath) {
result = path.join(result, path.relative(this.rootPath, this.projectPath));
}

return result;
}

private createLaunchConfiguration(): ConsoleLaunchConfiguration {
return {
name: '.NET Core Launch (console)',
Expand All @@ -187,7 +202,7 @@ export class AssetGenerator {
preLaunchTask: 'build',
program: this.computeProgramPath(),
args: [],
cwd: '${workspaceRoot}',
cwd: this.computeWorkingDirectory(),
console: "internalConsole",
stopAtEntry: false,
internalConsoleOptions: "openOnSessionStart"
Expand All @@ -202,7 +217,7 @@ export class AssetGenerator {
preLaunchTask: 'build',
program: this.computeProgramPath(),
args: [],
cwd: '${workspaceRoot}',
cwd: this.computeWorkingDirectory(),
stopAtEntry: false,
internalConsoleOptions: "openOnSessionStart",
launchBrowser: {
Expand Down Expand Up @@ -233,7 +248,7 @@ export class AssetGenerator {
name: '.NET Core Attach',
type: 'coreclr',
request: 'attach',
processId: "${command.pickProcess}"
processId: "${command:pickProcess}"
};
}

Expand Down
6 changes: 3 additions & 3 deletions src/tools/OptionsSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,12 @@
"anyOf": [
{
"type": "string",
"description": "The process id to attach to. Use \"${command.pickProcesss}\" to get a list of running processes to attach to. If 'processId' used, 'processName' should not be used.",
"default": "${command.pickProcess}"
"description": "The process id to attach to. Use \"${command:pickProcesss}\" to get a list of running processes to attach to. If 'processId' used, 'processName' should not be used.",
"default": "${command:pickProcess}"
},
{
"type": "integer",
"description": "The process id to attach to. Use \"${command.pickProcesss}\" to get a list of running processes to attach to. If 'processId' used, 'processName' should not be used.",
"description": "The process id to attach to. Use \"${command:pickProcesss}\" to get a list of running processes to attach to. If 'processId' used, 'processName' should not be used.",
"default": 0
}
]
Expand Down

0 comments on commit c32f17b

Please sign in to comment.