Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c6f4498

Browse files
committedJan 17, 2017
If PowerShell has not fully initialized then err.
Tell user to try again after PowerShell has fully initialized. This is not an ideal user experience but it is better than the current experience.
1 parent c9390bf commit c6f4498

File tree

1 file changed

+31
-28
lines changed

1 file changed

+31
-28
lines changed
 

‎src/features/DebugSession.ts

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -73,35 +73,38 @@ export class PickPSHostProcessFeature implements IFeature {
7373
vscode.commands.registerCommand('PowerShell.PickPSHostProcess', () => {
7474

7575
if (!this.languageClient && !this.waitingForClientToken) {
76+
return new Promise<string>((resolve, reject) => {
77+
reject("PowerShell has not fully initialized. Try to attach again after PowerShell has been initialized.");
78+
});
7679

77-
// If PowerShell isn't finished loading yet, show a loading message
78-
// until the LanguageClient is passed on to us
79-
var cancelled = false;
80-
var timedOut = false;
81-
this.waitingForClientToken = new vscode.CancellationTokenSource();
82-
83-
vscode.window
84-
.showQuickPick(
85-
["Cancel"],
86-
{ placeHolder: "Attach to PowerShell host process: Please wait, starting PowerShell..." },
87-
this.waitingForClientToken.token)
88-
.then(response => {
89-
if (response === "Cancel") {
90-
this.clearWaitingToken();
91-
}
92-
});
93-
94-
// Cancel the loading prompt after 60 seconds
95-
setTimeout(() => {
96-
if (this.waitingForClientToken) {
97-
this.clearWaitingToken();
98-
99-
vscode.window.showErrorMessage(
100-
"Attach to PowerShell host process: PowerShell session took too long to start.");
101-
}
102-
}, 60000);
103-
104-
// Wait w/timeout on language client to be initialized and then return this.pickPSHostProcess;
80+
// // If PowerShell isn't finished loading yet, show a loading message
81+
// // until the LanguageClient is passed on to us
82+
// var cancelled = false;
83+
// var timedOut = false;
84+
// this.waitingForClientToken = new vscode.CancellationTokenSource();
85+
86+
// vscode.window
87+
// .showQuickPick(
88+
// ["Cancel"],
89+
// { placeHolder: "Attach to PowerShell host process: Please wait, starting PowerShell..." },
90+
// this.waitingForClientToken.token)
91+
// .then(response => {
92+
// if (response === "Cancel") {
93+
// this.clearWaitingToken();
94+
// }
95+
// });
96+
97+
// // Cancel the loading prompt after 60 seconds
98+
// setTimeout(() => {
99+
// if (this.waitingForClientToken) {
100+
// this.clearWaitingToken();
101+
102+
// vscode.window.showErrorMessage(
103+
// "Attach to PowerShell host process: PowerShell session took too long to start.");
104+
// }
105+
// }, 60000);
106+
107+
// // Wait w/timeout on language client to be initialized and then return this.pickPSHostProcess;
105108
}
106109
else {
107110
return this.pickPSHostProcess();

0 commit comments

Comments
 (0)
Please sign in to comment.