Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not sort targets from mirrord ls, they already come in a neat order. #150

Merged
merged 4 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
}
}
}
Loading