fix: nonfatal missing key commands (resolves #6397)j
This PR changes the behaviour so that binding missing key commands in a user's config is not a fatal error that prevents the startup of opencode entirely.
With this PR, keybindings for non-existent keywords, when struck will instead display a toast saying "No command 'the_fake_command_name'".
Resolves #6397.
this shouldn't be enforced on the tui side, I would expect the tui to always be fed a valid config, and maybe u can introduce a config event for warnings that you emit that the tui could display
@rekram1-node Alright, I'll look into how that could work and see what I can come up with.
@rekram1-node Well.... it turned out to be a lot trickier to do than I thought it would, but after a few rerolls this does seem to be doing it in the way that you'd requested?
- strips the 'unknown' key commands out prior to validation, so the config always receives a valid config.
- -emits a
config.warningBusEvent that TUI then consumes and reacts to by displaying a warning likeUnknown key commands: foo, bar. - retains the
Unknown key command: footoast upon striking one of these keys.
Whaddya think? If there are further refinements you'd like. don't hesitate to ask!
Hey! Your PR title Fix: nonfatal missing key commands (resolves #6397) doesn't follow conventional commit format.
Please update it to start with one of:
-
feat:orfeat(scope):new feature -
fix:orfix(scope):bug fix -
docs:ordocs(scope):documentation changes -
chore:orchore(scope):maintenance tasks -
refactor:orrefactor(scope):code refactoring -
test:ortest(scope):adding or updating tests
Where scope is the package name (e.g., app, desktop, opencode).
See CONTRIBUTING.md for details.
Requires further testing/revision after significant recent changes in dev, re-drafting until that's been done.