Skip to content

Commit

Permalink
Fix paulober#227, Switch stubs error
Browse files Browse the repository at this point in the history
Signed-off-by: paulober <[email protected]>
  • Loading branch information
paulober committed Jun 22, 2024
1 parent e7e66c4 commit 06387cc
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/activator.mts
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,13 @@ export default class Activator {
// Map each value to "key - value" and push to resultArray
versions.push(
...values.map(value =>
`${stubPortToDisplayString(key)} - ${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 All @@ -1147,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 06387cc

Please sign in to comment.