Action not resolved by TaskAssistant

I’m trying to add a couple resolved tasks to my extension, but keep seeing the error:

Could not run “Cargo”.
The extension assistant with identifier “com.kilb.rust::com.kilb.rust.assistants.cargo” failed to resolve the action.

My assistant currently looks like this to test functionality:

class CargoTaskAssistant {
  provideTasks() {
    return [];
  }

  resolveTaskAction(context) {
    return new TaskProcessAction('cargo', {
      shell: true,
      args: ['build'],
    });
  }
}

I register it in my extension’s activate function:

let cargoTasks = new CargoTaskAssistant();
nova.assistants.registerTaskAssistant(cargoTasks, {
  identifer: 'com.kilb.rust.assistants.cargo',
  name: 'Cargo',
});

Finally, my task template in my extension.json looks like this:

"taskTemplates": {
  "cargo": {
    "name": "Cargo",
    "description": "Easily set up common Cargo commands.",
    "tasks": {
      "build": {
        "resolve": "com.kilb.rust.assistants.cargo"
      },
      "run": {
        "resolve": "com.kilb.rust.assistants.cargo"
      },
      "clean": {
        "shell": true,
        "command": "cargo",
        "args": ["clean"]
      }
    },
    "config": [ ... ]
  }
}

What am I missing?

Hello Drew,

Can you confirm that your extension’s JavaScript component is starting? If you place a console.log() in the exports.activate function or something similar it should make it clear.

If it’s not starting, it’s possible that your extension activation events are not triggering it to be loaded.

Yes, I placed a console.log() just before I registered the task assistant and saw it in the extension console for a relevant project. A console log in the resolveTaskAction handler does not fire, however.

Hah. This took me copying your code directly to figure it out. You have the key identifer, not identifier, when registering your assistant. That’ll cause the assistant to get a randomly generated UUID for its identifier, and thus resolution will fail.

Maybe we could detect cases like this somehow.

Let me know if that fixes it for you!

:man_facepalming:t2: I knew I had to be missing something simple. Thank you for linting my code!

On a related note, I need to figure out how to contribute to the @types/nova-editor-node definitions. I have a few other small fixes to make.

@drew I’m trying to do the same. You can fork the repo and make a pull request. The PR approval process is difficult and I haven’t gotten my PR through yet.

There are instructions in the definitelytyped readme