Skip to content

Fix debugger to start language client when necessary #4125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"url": "https://github.com/PowerShell/vscode-powershell.git"
},
"activationEvents": [
"onDebugInitialConfigurations",
"onDebugResolve:PowerShell",
"onLanguage:powershell",
"onCommand:PowerShell.NewProjectFromTemplate",
Expand Down
8 changes: 2 additions & 6 deletions src/features/DebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,9 @@ export class DebugSessionFeature extends LanguageClientConsumer
_folder: WorkspaceFolder | undefined,
config: DebugConfiguration,
_token?: CancellationToken): Promise<DebugConfiguration> {
// Make sure there is a session running before attempting to debug/run a program
// TODO: Perhaps this should just wait until it's running or aborted.

if (this.sessionManager.getSessionStatus() !== SessionStatus.Running) {
const msg = "Cannot debug or run a PowerShell script until the PowerShell session has started. " +
"Wait for the PowerShell session to finish starting and try again.";
vscode.window.showWarningMessage(msg);
return undefined;
await this.sessionManager.start();
}

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