Skip to content

Commit

Permalink
Open the "SSH Quick Open" on the current tab, not terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
sedwards2009 committed Jul 13, 2024
1 parent 3f00ae9 commit 6d6142a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions extensions/SSHQuickOpen/src/SSHQuickOpenExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function activate(_context: ExtensionContext): any {
context.commands.registerCommand("ssh-quick-open:open", quickOpenCommand);
}

// Note: This is mostlyduplicated in SSHSessionEditorExtension.ts.
// Note: This is mostly duplicated in SSHSessionEditorExtension.ts.
interface SSHSessionConfiguration extends SessionConfiguration {
host?: string;
port?: number;
Expand All @@ -26,7 +26,7 @@ interface SSHSessionConfiguration extends SessionConfiguration {
}

async function quickOpenCommand(): Promise<void> {
const sshConnectionString = await context.activeTerminal.tab.showTextInput({
const sshConnectionString = await context.activeTab.showTextInput({
message: "Enter a SSH connection string:",
value: "",
});
Expand Down
4 changes: 4 additions & 0 deletions main/src/extension/api/ExtensionContextImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ export class ExtensionContextImpl implements ExtensionApi.ExtensionContext, Exte
return this.#internalExtensionContext.getActiveWindow();
}

get activeTab(): ExtensionApi.Tab {
return this.#internalExtensionContext.wrapTab(this.#internalExtensionContext.getActiveInternalTab());
}

get application(): ExtensionApi.Application {
return this.#application;
}
Expand Down
8 changes: 7 additions & 1 deletion packages/extraterm-extension-api/src/ExtensionContext.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 Simon Edwards <[email protected]>
* Copyright 2024 Simon Edwards <[email protected]>
*
* This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
*/
Expand All @@ -10,6 +10,7 @@ import { Window, Windows } from "./Windows.js";
import { Terminal, Terminals } from "./Terminal.js";
import { Block } from "./Block.js";
import { Settings } from "./Settings.js";
import { Tab } from "./Tab.js";


/**
Expand Down Expand Up @@ -113,6 +114,11 @@ export interface ExtensionContext {

readonly activeWindow: Window;

/**
* The currently active/focussed tab.
*/
readonly activeTab: Tab;

readonly application: Application;

readonly commands: Commands;
Expand Down

0 comments on commit 6d6142a

Please sign in to comment.