{"action":"created","issue":{"url":"https://api.github.com/repos/PowerShell/vscode-powershell/issues/88","repository_url":"https://api.github.com/repos/PowerShell/vscode-powershell","labels_url":"https://api.github.com/repos/PowerShell/vscode-powershell/issues/88/labels{/name}","comments_url":"https://api.github.com/repos/PowerShell/vscode-powershell/issues/88/comments","events_url":"https://api.github.com/repos/PowerShell/vscode-powershell/issues/88/events","html_url":"https://github.com/PowerShell/vscode-powershell/issues/88","id":131956268,"number":88,"title":"Allow user to customize the working dir that the debugger starts in","user":{"login":"rkeithhill","id":5177512,"avatar_url":"https://avatars.githubusercontent.com/u/5177512?v=3","gravatar_id":"","url":"https://api.github.com/users/rkeithhill","html_url":"https://github.com/rkeithhill","followers_url":"https://api.github.com/users/rkeithhill/followers","following_url":"https://api.github.com/users/rkeithhill/following{/other_user}","gists_url":"https://api.github.com/users/rkeithhill/gists{/gist_id}","starred_url":"https://api.github.com/users/rkeithhill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkeithhill/subscriptions","organizations_url":"https://api.github.com/users/rkeithhill/orgs","repos_url":"https://api.github.com/users/rkeithhill/repos","events_url":"https://api.github.com/users/rkeithhill/events{/privacy}","received_events_url":"https://api.github.com/users/rkeithhill/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/PowerShell/vscode-powershell/labels/enhancement","name":"enhancement","color":"207de5"}],"state":"open","locked":false,"assignee":{"login":"rkeithhill","id":5177512,"avatar_url":"https://avatars.githubusercontent.com/u/5177512?v=3","gravatar_id":"","url":"https://api.github.com/users/rkeithhill","html_url":"https://github.com/rkeithhill","followers_url":"https://api.github.com/users/rkeithhill/followers","following_url":"https://api.github.com/users/rkeithhill/following{/other_user}","gists_url":"https://api.github.com/users/rkeithhill/gists{/gist_id}","starred_url":"https://api.github.com/users/rkeithhill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkeithhill/subscriptions","organizations_url":"https://api.github.com/users/rkeithhill/orgs","repos_url":"https://api.github.com/users/rkeithhill/repos","events_url":"https://api.github.com/users/rkeithhill/events{/privacy}","received_events_url":"https://api.github.com/users/rkeithhill/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/PowerShell/vscode-powershell/milestones/6","html_url":"https://github.com/PowerShell/vscode-powershell/milestones/0.4.0","labels_url":"https://api.github.com/repos/PowerShell/vscode-powershell/milestones/6/labels","id":1467476,"number":6,"title":"0.4.0","description":null,"creator":{"login":"daviwil","id":79405,"avatar_url":"https://avatars.githubusercontent.com/u/79405?v=3","gravatar_id":"","url":"https://api.github.com/users/daviwil","html_url":"https://github.com/daviwil","followers_url":"https://api.github.com/users/daviwil/followers","following_url":"https://api.github.com/users/daviwil/following{/other_user}","gists_url":"https://api.github.com/users/daviwil/gists{/gist_id}","starred_url":"https://api.github.com/users/daviwil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daviwil/subscriptions","organizations_url":"https://api.github.com/users/daviwil/orgs","repos_url":"https://api.github.com/users/daviwil/repos","events_url":"https://api.github.com/users/daviwil/events{/privacy}","received_events_url":"https://api.github.com/users/daviwil/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":9,"state":"open","created_at":"2015-12-18T23:55:00Z","updated_at":"2016-02-07T17:39:25Z","due_on":null,"closed_at":null},"comments":8,"created_at":"2016-02-07T10:21:48Z","updated_at":"2016-02-07T19:10:37Z","closed_at":null,"body":"Technically you can do this without any change to the package.json file but without `cwd` being defined in the `configurationProperties`, VSCode will whine when you edit a launch.json file and add the property."},"comment":{"url":"https://api.github.com/repos/PowerShell/vscode-powershell/issues/comments/181086927","html_url":"https://github.com/PowerShell/vscode-powershell/issues/88#issuecomment-181086927","issue_url":"https://api.github.com/repos/PowerShell/vscode-powershell/issues/88","id":181086927,"user":{"login":"rkeithhill","id":5177512,"avatar_url":"https://avatars.githubusercontent.com/u/5177512?v=3","gravatar_id":"","url":"https://api.github.com/users/rkeithhill","html_url":"https://github.com/rkeithhill","followers_url":"https://api.github.com/users/rkeithhill/followers","following_url":"https://api.github.com/users/rkeithhill/following{/other_user}","gists_url":"https://api.github.com/users/rkeithhill/gists{/gist_id}","starred_url":"https://api.github.com/users/rkeithhill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkeithhill/subscriptions","organizations_url":"https://api.github.com/users/rkeithhill/orgs","repos_url":"https://api.github.com/users/rkeithhill/repos","events_url":"https://api.github.com/users/rkeithhill/events{/privacy}","received_events_url":"https://api.github.com/users/rkeithhill/received_events","type":"User","site_admin":false},"created_at":"2016-02-07T19:10:37Z","updated_at":"2016-02-07T19:10:37Z","body":"Heheh, yup working on that. Here is what I have:\r\n```csharp\r\n// Set the working directory for the PowerShell runspace to something reasonable\r\n// such as the cwd passed in via launch.json. And in case that is null, use the\r\n// the folder of the script to be executed.  If cwd is a file path then extract the \r\n// directory and use that.\r\nstring workingDir = launchParams.Cwd ?? launchParams.Program;\r\ntry\r\n{\r\n    if ((File.GetAttributes(workingDir) & FileAttributes.Directory) != FileAttributes.Directory)\r\n    {\r\n        workingDir = Path.GetDirectoryName(workingDir);\r\n    }\r\n}\r\ncatch (Exception ex)\r\n{\r\n    Logger.Write(LogLevel.Error, \"cwd path is bad: \" + ex.Message);\r\n}\r\n\r\nvar setWorkingDirCommand = new PSCommand();\r\nsetWorkingDirCommand.AddCommand(@\"Microsoft.PowerShell.Management\\Set-Location\")\r\n    .AddParameter(\"LiteralPath\", workingDir);\r\n\r\nawait editorSession.PowerShellContext.ExecuteCommand(setWorkingDirCommand);\r\n```\r\nNote that I can't seem to set a default cwd value of `${file}` in package.json.  VSCode just sends in the workspace root dir as cwd **fi** cwd is not set in launch.json  I think this is probably OK since the launch.json that will get created should have `\"cwd\": \"${file}\"` set in it.  What do you think?"}}