Sort Swiftly toolchains by version in descending order #1870
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Swiftly toolchains in the toolchain selection dialog were being sorted by name which sorts incorrectly in some cases. For example,
5.10.0
will come after5.9.0
even though it should be the other way around. This was because the sorting happened after we already converted the version to a string.Move the sorting to before we map to string so that we have better control over the order in which toolchains are sorted. This means that the sorting is done in the
Swiftly
class rather than downstream. I also took this opportunity to remove some duplicated code and clean up a few variable names.In legacy mode (Swiftly <1.1.0) we don't have the actual version numbers unless we do some brittle parsing. So, we'll have to keep sorting by name in that case.
Tasks
[ ] Documentation has been updated[ ] Added an entry to CHANGELOG.md if applicable