@@ -594,36 +594,36 @@ class WebSocketTerminal implements vscode.Pseudoterminal {
594
594
}
595
595
}
596
596
597
+ function reportError ( msg : string , throwErrors = false ) {
598
+ if ( throwErrors ) {
599
+ throw new Error ( msg ) ;
600
+ } else {
601
+ vscode . window . showErrorMessage ( msg , "Dismiss" ) ;
602
+ }
603
+ }
604
+
597
605
function terminalConfigForUri (
598
606
api : AtelierAPI ,
599
607
extensionUri : vscode . Uri ,
600
608
targetUri : vscode . Uri ,
601
609
throwErrors = false
602
610
) : vscode . ExtensionTerminalOptions | undefined {
603
- const reportError = ( msg : string ) => {
604
- if ( throwErrors ) {
605
- throw new Error ( msg ) ;
606
- } else {
607
- vscode . window . showErrorMessage ( msg , "Dismiss" ) ;
608
- }
609
- } ;
610
-
611
611
// Make sure the server connection is active
612
612
if ( ! api . active || api . ns == "" ) {
613
- reportError ( "WebSocket Terminal requires an active server connection." ) ;
613
+ reportError ( "WebSocket Terminal requires an active server connection." , throwErrors ) ;
614
614
return ;
615
615
}
616
616
// Make sure the server has the terminal endpoint
617
617
if ( api . config . apiVersion < 7 ) {
618
- reportError ( "WebSocket Terminal requires InterSystems IRIS version 2023.2 or above." ) ;
618
+ reportError ( "WebSocket Terminal requires InterSystems IRIS version 2023.2 or above." , throwErrors ) ;
619
619
return ;
620
620
}
621
621
622
622
return {
623
623
name : api . config . serverName && api . config . serverName != "" ? api . config . serverName : "iris" ,
624
624
location :
625
625
// Mimic what a built-in profile does. When it is the default and the Terminal tab is selected while empty,
626
- // an terminal is always created in the Panel.
626
+ // a terminal is always created in the Panel.
627
627
vscode . workspace . getConfiguration ( "terminal.integrated" , targetUri ) . get ( "defaultLocation" ) === "editor" &&
628
628
vscode . window . terminals . length > 0
629
629
? vscode . TerminalLocation . Editor
@@ -634,11 +634,11 @@ function terminalConfigForUri(
634
634
} ;
635
635
}
636
636
637
- async function workspaceUriForTerminal ( ) {
637
+ async function workspaceUriForTerminal ( throwErrors = false ) {
638
638
let uri : vscode . Uri ;
639
639
const workspaceFolders = vscode . workspace . workspaceFolders || [ ] ;
640
640
if ( workspaceFolders . length == 0 ) {
641
- throw new Error ( "WebSocket Terminal requires an open workspace." ) ;
641
+ reportError ( "WebSocket Terminal requires an open workspace." , throwErrors ) ;
642
642
} else if ( workspaceFolders . length == 1 ) {
643
643
// Use the current connection
644
644
uri = workspaceFolders [ 0 ] . uri ;
@@ -687,7 +687,7 @@ export class WebSocketTerminalProfileProvider implements vscode.TerminalProfileP
687
687
688
688
async provideTerminalProfile ( _token : vscode . CancellationToken ) : Promise < vscode . TerminalProfile > {
689
689
// Determine the server connection to use
690
- const uri : vscode . Uri = await workspaceUriForTerminal ( ) ;
690
+ const uri : vscode . Uri = await workspaceUriForTerminal ( true ) ;
691
691
692
692
if ( uri ) {
693
693
// Get the terminal configuration. Will throw if there's an error.
0 commit comments