-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Turn menus contributions into dict of arbitrary key to list of MenuItems #175
Conversation
Codecov Report
@@ Coverage Diff @@
## main #175 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 27 27
Lines 1797 1789 -8
=========================================
- Hits 1797 1789 -8
Continue to review full report at Codecov.
|
I think failing quietly is good. I'd like to have structural validation - that the entry in the manifest is well-formed. But the missing foreign reference can fail quietly. Warning on |
Yeah, all the |
this includes #174
@sofroniewn toyed with this pattern at some point in the hackathon... I think this is the right way for us to do menus.
Menus are still a key value pair, where the key is a string "menu id" (could be anything, not validated at the moment of manifest consumption) and the value is a List of
MenuItem
, whereMenuItem
is the union of a SubMenu or MenuCommand.I dug into vscode a bit more, and this is how they do it. There is no validation of the key at ingestion of the manifest. You can put nonsense and it fails quietly. Napari then asks for all of the contributions of a given menu key. I don't think that "quiet" failure is a problem, particularly given that we don't know what the set of all valid keys is at that moment. If anyone is concerned about that, I think:
npe2 validate
that warns if a key is not a known napari key (i.e., if a plugin wants to opt in to only ever contributing to napari keys, we can tell them if they've done anything wrong... but as a command line tool)