Skip to content

Commit

Permalink
Merge pull request #228 from wtakuo/fix-227-switch-stubs-error
Browse files Browse the repository at this point in the history
Fix #227, Switch stubs error
  • Loading branch information
paulober authored Jun 22, 2024
2 parents 474c7dd + 06387cc commit 0f2d3e2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/activator.mts
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,10 @@ export default class Activator {
// Map each value to "key - value" and push to resultArray
versions.push(
...values.map(value =>
// differentiate between multiple stub ports and single
// to reduce UI clutter for version selection
// after a user selected a certain port already
// but still support multiple ports per selection
Object.keys(availableStubVersions).length > 1
? `${stubPortToDisplayString(key)} - ${value}`
: value
Expand Down Expand Up @@ -1149,12 +1153,16 @@ export default class Activator {
async (progress, token) => {
// cancellation is not possible
token.onCancellationRequested(() => undefined);
const versionParts = version.split(" - ");
const versionParts = version.includes(" - ")
? version.split(" - ")
: [Object.keys(availableStubVersions)[0], version];

// TODO: implement cancellation
const result = await installStubsByVersion(
versionParts[1],
displayStringToStubPort(versionParts[0]),
version.includes(" - ")
? displayStringToStubPort(versionParts[0])
: versionParts[0],
settings
);

Expand Down

0 comments on commit 0f2d3e2

Please sign in to comment.