diff --git a/package.json b/package.json index 9fe3717750..8c28288f1e 100644 --- a/package.json +++ b/package.json @@ -257,9 +257,9 @@ "type": "PowerShell", "request": "launch", "name": "PowerShell Launch ${Script}", - "script": "^\"\\${workspaceRoot}/${Script}\"", + "script": "^\"\\${workspaceFolder}/${Script}\"", "args": [], - "cwd": "^\"\\${workspaceRoot}\"" + "cwd": "^\"\\${workspaceFolder}\"" } }, { @@ -271,7 +271,7 @@ "name": "PowerShell Pester Tests", "script": "Invoke-Pester", "args": [], - "cwd": "^\"\\${workspaceRoot}\"" + "cwd": "^\"\\${workspaceFolder}\"" } }, { @@ -292,17 +292,13 @@ "type": "PowerShell", "request": "launch", "name": "PowerShell Interactive Session", - "cwd": "^\"\\${workspaceRoot}\"" + "cwd": "" } } ], "configurationAttributes": { "launch": { "properties": { - "program": { - "type": "string", - "description": "Deprecated. Please use the 'script' property instead to specify the absolute path to the PowerShell script to launch under the debugger." - }, "script": { "type": "string", "description": "Optional: Absolute path to the PowerShell script to launch under the debugger." @@ -317,8 +313,8 @@ }, "cwd": { "type": "string", - "description": "Absolute path to the working directory. Default is the current workspace.", - "default": "${workspaceRoot}" + "description": "Absolute path to the working directory. Default is the current workspace folder.", + "default": "${workspaceFolder}" }, "createTemporaryIntegratedConsole": { "type": "boolean", @@ -385,7 +381,7 @@ "type": "PowerShell", "request": "launch", "name": "PowerShell Interactive Session", - "cwd": "${workspaceRoot}" + "cwd": "" } ] } diff --git a/src/features/DebugSession.ts b/src/features/DebugSession.ts index 902d314a07..e488f464b9 100644 --- a/src/features/DebugSession.ts +++ b/src/features/DebugSession.ts @@ -2,14 +2,12 @@ * Copyright (C) Microsoft Corporation. All rights reserved. *--------------------------------------------------------*/ -import { hostname } from "os"; -import { dirname } from "path"; import vscode = require("vscode"); import { CancellationToken, DebugConfiguration, DebugConfigurationProvider, ExtensionContext, ProviderResult, WorkspaceFolder } from "vscode"; -import { LanguageClient, NotificationType, RequestType } from "vscode-languageclient"; +import { LanguageClient, RequestType } from "vscode-languageclient"; import { IFeature } from "../feature"; -import { getPlatformDetails, IPlatformDetails, OperatingSystem } from "../platform"; +import { getPlatformDetails, OperatingSystem } from "../platform"; import { PowerShellProcess} from "../process"; import { SessionManager } from "../session"; import Settings = require("../settings"); @@ -19,7 +17,6 @@ export class DebugSessionFeature implements IFeature, DebugConfigurationProvider private sessionCount: number = 1; private command: vscode.Disposable; - private examplesPath: string; private tempDebugProcess: PowerShellProcess; constructor(context: ExtensionContext, private sessionManager: SessionManager) { @@ -75,12 +72,18 @@ export class DebugSessionFeature implements IFeature, DebugConfigurationProvider ? currentDocument.uri.toString() : currentDocument.fileName; - // For a folder-less workspace, vscode.workspace.rootPath will be undefined. - // PSES will convert that undefined to a reasonable working dir. - config.cwd = - currentDocument.isUntitled - ? vscode.workspace.rootPath - : currentDocument.fileName; + if (settings.debugging.createTemporaryIntegratedConsole) { + // For a folder-less workspace, vscode.workspace.rootPath will be undefined. + // PSES will convert that undefined to a reasonable working dir. + config.cwd = + currentDocument.isUntitled + ? vscode.workspace.rootPath + : currentDocument.fileName; + + } else { + // If the non-temp integrated console is being used, default to the current working dir. + config.cwd = ""; + } } if (config.request === "launch") {