Skip to content

Commit

Permalink
Improvement: "Open Terminal IP" should just open the terminal, (#32)
Browse files Browse the repository at this point in the history
"Open Terminal IP" should just open the terminal, not just in the
command palette
renaming "Open Terminal" to "Connect"
  • Loading branch information
jharajeev55 authored Jul 15, 2024
1 parent a7099df commit c4b9ae8
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/00-bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ body:
description: List the steps you took to exhibit the issue.
placeholder: |
Example:
1. Open Command Pallette and enter "TSP: Open Terminal"
1. Open Command Pallette and enter "TSP: Connect"
2. Select "New Connection"
3. Type in IP address for 2450
4. After connection, enter `print("some string that breaks the terminal")`
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ following commands:

| Command | Description | Shortcut |
|:---------------------------------|:------------------------------------------------------------------------------------|:------------------------------------------------|
| TSP: Open Terminal | Opens a new terminal session to an instrument (be sure to close with `.exit`, see the [Known Issues](#known-issues) section below) | |
| TSP: Connect | Opens a new terminal session to an instrument (be sure to close with `.exit`, see the [Known Issues](#known-issues) section below) | |
| TSP: Send Script to Terminal | Sends the script in the current editor window to the currently connected instrument | |

To see all available Keithley TSP Toolkit commands, open the Command Pallette and type `TSP`.
Expand All @@ -76,7 +76,7 @@ then it is possible to have TSP Toolkit automatically configure your project for

1. Open any workspace folder in VSCode
2. If your workspace folder does not already contain one, create a .tsp (for example `my-tsp-file.tsp`)
3. Connect to your instrument using the discovery pane or the `TSP: Open Terminal` command.
3. Connect to your instrument using the discovery pane or the `TSP: Connect` command.
4. Right-click on the `.vscode/tspConfig` folder
5. Select "Fetch TSP-Link Nodes for Connected Instrument"

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"commands": [
{
"command": "tsp.openTerminal",
"title": "Open Terminal",
"title": "Connect",
"category": "TSP"
},
{
Expand All @@ -55,7 +55,7 @@
},
{
"command": "tsp.openTerminalIP",
"title": "Open Terminal",
"title": "Connect",
"category": "TSP"
},
{
Expand Down
11 changes: 8 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,14 @@ async function startRename(def: unknown): Promise<void> {
}

function connectCmd(def: object) {
const [res1, res2, res3] = _instrExplorer.fetchConnectionArgs(def)
//console.log(res1, res2, res3)
void connect(res1, res2, res3)
const [connection_str, model_serial] =
_instrExplorer.fetchConnectionArgs(def)

if (_activeConnectionManager?.connectionRE.test(connection_str)) {
void createTerminal(connection_str, model_serial)
} else {
void vscode.window.showErrorMessage("Unable to connect.")
}
}

const base_api = {
Expand Down
10 changes: 6 additions & 4 deletions src/instruments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1341,18 +1341,20 @@ export class InstrumentsExplorer {
}
}

public fetchConnectionArgs(item: object): [string, boolean, string?] {
public fetchConnectionArgs(
item: object
): [connection_str: string, model_serial?: string] {
const resNode = item as IOInstrNode
if (resNode != undefined) {
const conn_name =
resNode.label + "@" + resNode.FetchConnectionAddr()
if (resNode.FetchInstrIOType() == IoType.Lan) {
return [conn_name, true]
return [conn_name]
} else {
return [conn_name, true, resNode.fetchModelSerial()]
return [conn_name, resNode.fetchModelSerial()]
}
}
return ["", false]
return [""]
}

private async upgradeFirmware(_e: unknown) {
Expand Down

0 comments on commit c4b9ae8

Please sign in to comment.