From 9bf0c2366d046635c6e8a8342b901ce404a4d9c8 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Tue, 4 Apr 2017 12:57:34 -0700 Subject: [PATCH 1/2] Fix error when debugging untitled script with no launch.json This change fixes an issue which causes and error to appear in the integrated console when debugging an untitled file without a launch.json configuration. The fix is to use the full Uri path when crafting a launch config for an untitled file. Resolves #648. --- src/features/DebugSession.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/features/DebugSession.ts b/src/features/DebugSession.ts index f827607f67..1da3ff44bd 100644 --- a/src/features/DebugSession.ts +++ b/src/features/DebugSession.ts @@ -25,13 +25,19 @@ export class DebugSessionFeature implements IFeature { private startDebugSession(config: any) { + let currentDocument = vscode.window.activeTextEditor.document; + if (!config.request) { // No launch.json, create the default configuration config.type = 'PowerShell'; config.name = 'PowerShell Launch Current File'; config.request = 'launch'; config.args = []; - config.script = vscode.window.activeTextEditor.document.fileName; + + config.script = + currentDocument.isUntitled + ? currentDocument.uri.toString() + : currentDocument.fileName; } if (config.request === 'launch') { @@ -41,7 +47,6 @@ export class DebugSessionFeature implements IFeature { // For launch of "current script", don't start the debugger if the current file // is not a file that can be debugged by PowerShell if (config.script === "${file}") { - let currentDocument = vscode.window.activeTextEditor.document; if (currentDocument.isUntitled) { if (currentDocument.languageId === 'powershell') { From 63627d913746ec120f3827e14317ebbc4f9ad175 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Tue, 4 Apr 2017 12:59:41 -0700 Subject: [PATCH 2/2] Bump version to 0.12.1, update CHANGELOG.md --- CHANGELOG.md | 7 +++++++ appveyor.yml | 2 +- package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 114c3aacbd..e4a662e78f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # vscode-powershell Release History +## 0.12.1 +### Tuesday, April 4, 2017 + +- Fixed [#648](https://github.com/PowerShell/vscode-powershell/issues/648) - + Resolved an error when launching an untitled script file in a workspace + with no launch.json or in a window without a workspace path + ## 0.12.0 ### Tuesday, April 4, 2017 diff --git a/appveyor.yml b/appveyor.yml index 4101e3f152..0321a9a234 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: '0.12.0-insiders-{build}' +version: '0.12.1-insiders-{build}' image: Visual Studio 2017 clone_depth: 10 skip_tags: true diff --git a/package.json b/package.json index f5f007d343..3a4235bef9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "PowerShell", "displayName": "PowerShell", - "version": "0.12.0", + "version": "0.12.1", "publisher": "ms-vscode", "description": "Develop PowerShell scripts in Visual Studio Code!", "engines": {