Skip to content

Commit 20c2135

Browse files
committed
Act on feedback from @isc-bsaviano
1 parent e2fb297 commit 20c2135

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/commands/webSocketTerminal.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -594,36 +594,36 @@ class WebSocketTerminal implements vscode.Pseudoterminal {
594594
}
595595
}
596596

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+
597605
function terminalConfigForUri(
598606
api: AtelierAPI,
599607
extensionUri: vscode.Uri,
600608
targetUri: vscode.Uri,
601609
throwErrors = false
602610
): 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-
611611
// Make sure the server connection is active
612612
if (!api.active || api.ns == "") {
613-
reportError("WebSocket Terminal requires an active server connection.");
613+
reportError("WebSocket Terminal requires an active server connection.", throwErrors);
614614
return;
615615
}
616616
// Make sure the server has the terminal endpoint
617617
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);
619619
return;
620620
}
621621

622622
return {
623623
name: api.config.serverName && api.config.serverName != "" ? api.config.serverName : "iris",
624624
location:
625625
// 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.
627627
vscode.workspace.getConfiguration("terminal.integrated", targetUri).get("defaultLocation") === "editor" &&
628628
vscode.window.terminals.length > 0
629629
? vscode.TerminalLocation.Editor
@@ -634,11 +634,11 @@ function terminalConfigForUri(
634634
};
635635
}
636636

637-
async function workspaceUriForTerminal() {
637+
async function workspaceUriForTerminal(throwErrors = false) {
638638
let uri: vscode.Uri;
639639
const workspaceFolders = vscode.workspace.workspaceFolders || [];
640640
if (workspaceFolders.length == 0) {
641-
throw new Error("WebSocket Terminal requires an open workspace.");
641+
reportError("WebSocket Terminal requires an open workspace.", throwErrors);
642642
} else if (workspaceFolders.length == 1) {
643643
// Use the current connection
644644
uri = workspaceFolders[0].uri;
@@ -687,7 +687,7 @@ export class WebSocketTerminalProfileProvider implements vscode.TerminalProfileP
687687

688688
async provideTerminalProfile(_token: vscode.CancellationToken): Promise<vscode.TerminalProfile> {
689689
// Determine the server connection to use
690-
const uri: vscode.Uri = await workspaceUriForTerminal();
690+
const uri: vscode.Uri = await workspaceUriForTerminal(true);
691691

692692
if (uri) {
693693
// Get the terminal configuration. Will throw if there's an error.

src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1311,7 +1311,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
13111311
),
13121312
vscode.commands.registerCommand(
13131313
"vscode-objectscript.intersystems-servermanager.webterminal",
1314-
async (namespaceTreeItem) => {
1314+
(namespaceTreeItem) => {
13151315
const idArray = namespaceTreeItem.id.split(":");
13161316
const serverId = idArray[1];
13171317
const namespace = idArray[3];

0 commit comments

Comments
 (0)