Theia: support vscode.CustomExecution api

Created on 20 Feb 2020  路  15Comments  路  Source: eclipse-theia/theia

Description

To see that Java language server is initializing need to click on the task button:
screenshot-localhost_3000-2020 02 (1)
But this button doesn't work:

command.ts:15 Uncaught (in promise) TypeError: i.CustomExecution is not a constructor
    at :3000/tmp/vscode-unpacked/java-0.57.0-2029.vsix/extension/dist/extension.js:7
    at Generator.next (<anonymous>)
    at o (:3000/tmp/vscode-unpacked/java-0.57.0-2029.vsix/extension/dist/extension.js:7)

Reproduction Steps

  1. Download vscode java plugin https://download.jboss.org/jbosstools/static/jdt.ls/stable/java-0.57.0-2029.vsix and put it into plugins folder
  2. Open the workspace with java project and try to click on the active task button

OS and Theia version:
Linux
@theia/example-browser 0.15.0

Diagnostics:

That's how it looks in vscode:

bug help wanted java tasks vscode

Most helpful comment

Hi @gsmachado,

A few pointers - those around here that know more than me can correct or complete:

vscode API doc: https://code.visualstudio.com/api/references/vscode-api#CustomExecution

implementation:
https://github.com/microsoft/vscode/blob/master/src/vs/workbench/api/common/extHostTypes.ts#L1874
https://github.com/microsoft/vscode/blob/master/src/vs/workbench/api/common/extHostTask.ts#L480

On the Theia side:
need to define CustomExecution in this file I think: https://github.com/eclipse-theia/theia/blob/master/packages/plugin/src/theia.d.ts#L8834

And probably to enhance this to look more like vscode above:
https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/plugin/tasks/tasks.ts#L62

examples of the API being used by vscode-gradle, that could be used to test: 1, 2

P.S. We generally do not reinvent the wheel. It's permissible to copy code from the vscode repo (MIT) so long as credit is given and the license respected. See this for example. If you do copy some code, please keep a log for each snippet, including file(s)/line(s)/range and from which vscode version. We'll need to go through an internal Eclipse Foundation process, that vets copied code, before we can merge, and your detailed log will facilitate this.

All 15 comments

I don't think we support CustomExecution VS Code api for tasks yet.

Version 0.54.2 of that extension is known to work well in Theia AFAIK. Could you try that version and report if you have the same issue?

https://github.com/redhat-developer/vscode-java/releases/download/v0.54.2/redhat.java-0.54.2.vsix

@marcdumais-work I test [email protected] it's work
but console have error Uncaught (in promise) TypeError: i.CustomExecution is not a constructor
when i click
image

Is implementation of CustomExecution planned?

Contributions to issues marked as help wanted and without any assignments are welcomed. It means that nobody is working or planning to work on them right now.

Someone from my team will take a look at this after the upcoming Che sprint, so sometime late August. Of course by no means should that stop someone else from working on it before then, if they want to!

Hey @ericwill

Some info:

I'm running theia 1.6.0, with vscode-java-redhat version 0.61.0, and tried to add this extension here.

However, I see this error when the extension starts:

[error] Unable to generate vscode tasks from gradle tasks: vscode.CustomExecution is not a constructor

Are you guys working on this? Anything I could do as a workaround to make it work?

@gsmachado no, it's not in the sprint plan. We're aware that this API is not implemented. It's a question of assigning resources.

@gsmachado no, it's not in the sprint plan. We're aware that this API is not implemented. It's a question of assigning resources.

Correct. @gsmachado if you propose a PR to theia, someone from our team can review it.

Correct. @gsmachado if you propose a PR to theia, someone from our team can review it.

Alright! I would be interested to do it, but I'm not even sure what's the correct behavior of this vscode.CustomExecution API, and where I can find the "reference implementation" of it.

I would appreciate any leads on this -- maybe I get inspired and get something done. 馃槃

Hi @gsmachado,

A few pointers - those around here that know more than me can correct or complete:

vscode API doc: https://code.visualstudio.com/api/references/vscode-api#CustomExecution

implementation:
https://github.com/microsoft/vscode/blob/master/src/vs/workbench/api/common/extHostTypes.ts#L1874
https://github.com/microsoft/vscode/blob/master/src/vs/workbench/api/common/extHostTask.ts#L480

On the Theia side:
need to define CustomExecution in this file I think: https://github.com/eclipse-theia/theia/blob/master/packages/plugin/src/theia.d.ts#L8834

And probably to enhance this to look more like vscode above:
https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/plugin/tasks/tasks.ts#L62

examples of the API being used by vscode-gradle, that could be used to test: 1, 2

P.S. We generally do not reinvent the wheel. It's permissible to copy code from the vscode repo (MIT) so long as credit is given and the license respected. See this for example. If you do copy some code, please keep a log for each snippet, including file(s)/line(s)/range and from which vscode version. We'll need to go through an internal Eclipse Foundation process, that vets copied code, before we can merge, and your detailed log will facilitate this.

@marcdumais-work awesome answer. You know, being in the open-source space for some time, that's what I believe we need more: people willing to at least explain, with a reasonable level of detail, what needs to be done, where people can start with, etc. This kind of thing motivates people. 馃憤 馃槃

@gsmachado I hope this is good to get you started. Please ask here if you have questions along the way.

Well, while this API is not implemented, is there a work-around? A way for plug-in authors to implement a Task that's simply a callback, for example, even if I have to keep two code versions (one for vscode and one for Theia)

Otherwise, my plug-in will not work at all :(

Well, while this API is not implemented, is there a work-around? A way for plug-in authors to implement a Task that's simply a callback, for example, even if I have to keep two code versions (one for vscode and one for Theia)

@mauricioszabo I do not believe there is a workaround at the moment, if the feature is important to your use-case you can always attempt to implement the API yourself and submit a pull-request. The following https://github.com/eclipse-theia/theia/issues/7185#issuecomment-703740249 describes the necessary changes in detail.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

akosyakov picture akosyakov  路  3Comments

akosyakov picture akosyakov  路  3Comments

jeanlucburot picture jeanlucburot  路  3Comments

vince-fugnitto picture vince-fugnitto  路  3Comments

fangnx picture fangnx  路  3Comments