Skip to content

Commit 13fa269

Browse files
Fix debugger to start language client when necessary (#4125)
Rather than just throwing an error message. Also don't activate on `onDebugInitialConfigurations` so that the extension doesn't startup unnecessarily.
1 parent 926dc43 commit 13fa269

File tree

3 files changed

+157
-177
lines changed

3 files changed

+157
-177
lines changed

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"url": "https://github.com/PowerShell/vscode-powershell.git"
2727
},
2828
"activationEvents": [
29-
"onDebugInitialConfigurations",
3029
"onDebugResolve:PowerShell",
3130
"onLanguage:powershell",
3231
"onCommand:PowerShell.NewProjectFromTemplate",

src/features/DebugSession.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,9 @@ export class DebugSessionFeature extends LanguageClientConsumer
153153
_folder: WorkspaceFolder | undefined,
154154
config: DebugConfiguration,
155155
_token?: CancellationToken): Promise<DebugConfiguration> {
156-
// Make sure there is a session running before attempting to debug/run a program
157-
// TODO: Perhaps this should just wait until it's running or aborted.
156+
158157
if (this.sessionManager.getSessionStatus() !== SessionStatus.Running) {
159-
const msg = "Cannot debug or run a PowerShell script until the PowerShell session has started. " +
160-
"Wait for the PowerShell session to finish starting and try again.";
161-
vscode.window.showWarningMessage(msg);
162-
return undefined;
158+
await this.sessionManager.start();
163159
}
164160

165161
// Starting a debug session can be done when there is no document open e.g. attach to PS host process

0 commit comments

Comments
 (0)