Essentially the idea is that a plugin shouldn’t fail silently. For example, your plugin may be assuming that there’s always something selected, but the reviewer may have tried your plugin without doing anything after having opened a document. The plugin may do nothing in this case, but it looks to the user as if it has failed. (The plugin may actually also have thrown an exception – but most users won’t see these either. So it still looks like a failing plugin.)
My suggestion is this simple: if
selection.items.length === 0 and your plugin requires a selection upon which to work, display an error message to the user asking them to select something first. Points if that message tells them what kinds of things they should select in order for your plugin to work.
If you look through the e2e-colorize-text sample, you can see a couple of examples like this:
- If nothing is selected, the plugin displays an error message asking the user to select some text elements
- If something is selected, but the selected nodes are all the wrong types, the plugin displays a message to the user indicating that it couldn’t do anything with the selection and reminds the user what to select