CommandsRegistry arguments documentation

According to the invoke documentation, all arguments following the name must be “transferrable”. However, in practice I’ve passed TextEditor objects directly into the invoke function, as several commands expect to receive one. I suspect this is just confusion in the docs that could be clarified.

Is it expected to be able to pass the non-transferrable TextEditor object when calling invoke?

If so, I need to fix the last update to the typescript types.

1 Like

This is only the case when you are invoking a command that is not present within your own extension, as extensions are run within their own individual JavaScript sandboxes and TextEditor objects won’t be transferrable between them. But within your own extension, it ends up not being much different from invoking the command function directly.

We generally don’t recommend trying to do so and breaking API contract, so I can consider making this check more strict in the future.

1 Like

Okay, I think the distinction between own extension and other extensions is what I was missing. Thanks!

1 Like