Skip to content

Commit

Permalink
Do not sort targets from mirrord ls, they already come in a neat or…
Browse files Browse the repository at this point in the history
…der. (#150)

* Dont sort targets here.

* changelog

* missing semicolon
  • Loading branch information
meowjesty authored Sep 6, 2024
1 parent 1edfec2 commit b26a031
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog.d/147.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Do not sort targets when showing them to the user, they come pre-sorted from mirrord ls.
7 changes: 3 additions & 4 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ interface IdeMessage {
* Replaces the "plugin" platform query parameter in the given link with "vscode"
*/
function changeQueryParam(link: string): string {
return link.replace("utm_medium=cli", "utm_medium=vscode").replace("utm_medium=plugin", "utm_medium=vscode")
return link.replace("utm_medium=cli", "utm_medium=vscode").replace("utm_medium=plugin", "utm_medium=vscode");
}

/**
Expand Down Expand Up @@ -350,7 +350,7 @@ export class MirrordAPI {

/**
* Uses `mirrord ls` to get a list of all targets.
* Targets are sorted, with an exception of the last used target being the first on the list.
* Targets come sorted, with an exception of the last used target being the first on the list.
*/
async listTargets(configPath: string | null | undefined): Promise<Targets> {
const args = ['ls'];
Expand All @@ -361,7 +361,6 @@ export class MirrordAPI {
const stdout = await this.exec(args, {});

const targets: string[] = JSON.parse(stdout);
targets.sort();

let lastTarget: string | undefined = globalContext.workspaceState.get(LAST_TARGET_KEY)
|| globalContext.globalState.get(LAST_TARGET_KEY);
Expand Down Expand Up @@ -589,4 +588,4 @@ function tickDiscordCounter() {
.withDisableAction('promptDiscord')
.info();
}
}
}

0 comments on commit b26a031

Please sign in to comment.