vmssoftware / vms-ide

MIT License
13 stars 3 forks source link

Extension commands do not return a string and thus cannot be used properly in tasks.json #12

Open Nuramon27 opened 1 year ago

Nuramon27 commented 1 year ago

When executing commands of the extension in a VSCode tasks.json-file via the "${command:vmssoftware.synchronizer.cmdName}"-syntax (as documented here), the task is executed successfully, but VSCode throws the error "Cannot substitute command variable 'vmssoftware.synchronizer.cmdName' because command did not return a result of type string". This turns into a real problem when defining tasks depending on each other, as this is interpreted by VSCode as the task failing, so dependent tasks are not further executed.

The problem, as documented here is that VSCode demands the return type of such commands to be a string.

My use-case is the following: Every time a user opens the workspace folder, VMS-IDE should first run the "update"-command to upload changes by the user and after completion run the "syncProject"-task to fetch changes from the server. So I would like to register these two commands as consecutive tasks in VScode’s tasks.json-file, with the second one waiting for completion of the first.

The extension seems to provide an (undocumented) task-type "task2cmd" by which commands of the extension can be executed. This has, however, the opposite problem: The task does not wait for the command to actually finish, but immediately returns. Then the second task complains that the extension is already running a job and fails.

So, as a solution, would it be possible to change the return type of extension commands to be strings?

vorfol commented 1 year ago

I'm afraid it's not practical to change return types of all extension commands to a string. PS: I made some commands to return 'string'. Testing...