Hi!
I spent the week mostly doing improvements and testing.
Detect duplicates in the custom keymap
If the same shortcut is used in two commands, the default keymap is used instead, and a helpful error message is logged to the console mentioning which shortcut is containing the duplicate.
This is different in having an invalid shortcut or command in one or few shortcut items. In that case, the app warns the user and skips over it.
Let me know what you think about this approach
Refactor keymapHandler.ts
to KeymapService
After a review from Laurent on my draft PR, it was decided that a class-based service would be the better way to handle the keymap operations, which makes sense. This is because the original keymapHandler module has its own state (in-memory keymap object) and provides few methods to alter it.
I've refactored keymapHandler into a service, which took me longer than I had expected.. I've learned a lot about how TypeScript differs from JavaScript during the transition.
A service in Joplin is class-based and (mostly) runs only one instance at a time, and has own logger. I've used this logger to display helpful errors and warnings to the user.
I've also had to spent a significant amount of time rewriting the existing tests and get them to work with the new service.
See my PR with the KeymapService here: https://github.com/laurent22/joplin/pull/3252
Cheers!