[settings-view] Fix Package keymap compatibility check #1161
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.
It turns out that for quite some time the way the package's keymap section checks for platform compatibility has been broken.
I've detailed the reason why in #1160, but basically, if a keymap listed multiple platforms, such as
linux
andwin32
the compatibility check would just see that it works on a platform other than the current one, and would think it's incompatible and not show it to the user.So I've gone ahead and fixed this check much in the same way we already check in
settings-view/lib/keybindings-panel.js
except I've expanded out on this functionality a bit, by creating a method for this check.Also, I've given the ability to pass in a platform rather than going with the current one, which makes it much easier to test this, and means if we wanted to in the future we could purposefully grab incompatible keymaps.
And since it's not testable, of course I've written new tests to be able to test this behavior.
Resolves #1160