@@ -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