Solved: Workspace config enum resolver unable to find command with name

Solved my own bug so I thought I’d post here for reference. Solution was not mentioned in the docs.

To begin with, enum resolvers don’t work in global config, only workspace config.

However, when enum resolver is used in workspace config, I get an error dialog saying:
“No command found with the name ‘myResolveCommand’. Check to make sure the extension for the command is installed and up to date.”

I have this inside my “config-workspace” key in extension.json

{
  "key": "my-enum-test",
  "title": "My enum test",
  "type": "enum",
  "resolve": "myResolveCommand",
  "allowCustom": true
}

And this inside my main.js

nova.commands.register('myResolveCommand', (workspace) => {
  console.log('Resolve command activated');
  return ['true', 'false'];
});

Why do I get the error? Because the extension has not fired its activationEvent yet.

Solution: Add your command to the activationEvents key

"activationEvents": [
   "onCommand:myResolveCommand"
],
1 Like