From 94e3a905bdf3e447a8f714012cb6307d8f4e0993 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Fri, 18 Mar 2016 12:22:00 -0700 Subject: [PATCH] Add VS Code launch and task files This enables building PowerShell through VS Code. The build task launches the installed version of PowerShell and runs `Start-PSBuild` (after importing the module). This enables a `launch` debug task to immediately debug the `powershell` process, without having to attach to an external process. The defaults of `justMyCode` and `stopAtEntry` have been reversed, so that all code is debugged, and the process is stopped at entry for easier debugging. Note that an interactive PowerShell process requires access to `stdin`, which the debug console does not provide, so once it requests access, `System.Console` will throw a (correct) exception. --- .vscode/launch.json | 16 ++++++++++++++++ .vscode/tasks.json | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000000..cb340619b2 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "powershell", + "type": "coreclr", + "request": "launch", + "justMyCode": false, + "stopAtEntry": true, + "program": "${workspaceRoot}/bin/powershell", + "args": [ ], + "preLaunchTask": "build", + "cwd": "${workspaceRoot}" + } + ] +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000000..b204ecfc90 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,16 @@ +{ + "version": "0.1.0", + "command": "powershell", + "isShellCommand": true, + "showOutput": "verbose", + "args": [ "--command" ], + + "tasks": [ + { + "taskName": "build", + "args": [ "Import-Module ${workspaceRoot}/PowerShellGitHubDev.psm1; Start-PSBuild" ], + "isBuildCommand": true, + "problemMatcher": "$msCompile" + } + ] +}