Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User defined tasks are not revealed when these are executed programmatically #9605

Closed
sunix opened this issue Jun 17, 2021 · 14 comments · Fixed by #9740
Closed

User defined tasks are not revealed when these are executed programmatically #9605

sunix opened this issue Jun 17, 2021 · 14 comments · Fixed by #9740
Labels
help wanted issues meant to be picked up, require help tasks issues related to the task system vscode issues related to VSCode compatibility

Comments

@sunix
Copy link
Contributor

sunix commented Jun 17, 2021

Bug Description:

User defined tasks are not revealed when these are executed programmatically.

Steps to Reproduce:

  1. clone/build and execute this VSCode extension on theia hosted mode https://github.com/sunix/vscode-test-task-execution
  2. create a user shell task with the Task: Configured tasks ... > Configure new Task > Others command, keep the default values:
    {
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
    	{
    		"label": "echo",
    		"type": "shell",
    		"command": "echo Hello"
    	}
    ]
    }
    
  3. Run the command vscode.tasks.executeTask the task named 'echo', this command will execute the task named echo with the api method vscode.tasks.executeTask(t);
  4. no task is reveal. But the task is executed in background.

Additional Information

It seems that the task object generated has https://github.com/sunix/vscode-test-task-execution/blob/e03b3fe41c2ce8e9c7a034542a77ad16bc3ea464/src/extension.ts#L28

                  presentationOptions: {
                    reveal: 'always',

instead of

                  presentationOptions: {
                    reveal: 1,

(1 is the value for vscode.TaskRevealKind.Always)

There is 2 additional commands that execute a Task object to see the diff:

  • the command vscode.tasks.executeTask with presentationOptions: { reveal: 'always' } with presentationOptions: { reveal: 'always' }. This is a copy of what we get when fetching a task created by the user.
  • the command vscode.tasks.executeTask with presentationOptions: { reveal: 1} the other with presentationOptions: { reveal: 1 } that reveals the task as expected.

Environment

  • Operating System: kubernetes
  • Theia Version: master branch
@vince-fugnitto vince-fugnitto added help wanted issues meant to be picked up, require help tasks issues related to the task system vscode issues related to VSCode compatibility labels Jun 17, 2021
@tsmaeder
Copy link
Contributor

tsmaeder commented Jun 17, 2021

Hmhh...it looks to me as if in your sample code, you're using an invalid value for the reveal field:

 reveal: JSON.parse('"always"'), // KO the task is not revealed

should not even compile, since it's of type any instead of the correct vscode.TaskRevealKind.

@sunix
Copy link
Contributor Author

sunix commented Jun 17, 2021

@tsmaeder yeah it's not compiling if I use

reveal: 'always'

but the JSON.parse is getting through the type check

@sunix
Copy link
Contributor Author

sunix commented Jun 17, 2021

this part is to recreate the same json object I got from the one I created by hand.

@tsmaeder
Copy link
Contributor

@sunix sorry, but I don't see how the example code demonstrates a problem: as far as the API goes, I see "garbage in, garbage out". I think you need to elaborate a bit more.

@sunix
Copy link
Contributor Author

sunix commented Jun 18, 2021

@tsmaeder ok I am reworking this

@tsmaeder
Copy link
Contributor

@sunix maybe it's enough if you just explain what the problem is.

@sunix
Copy link
Contributor Author

sunix commented Jun 18, 2021

@tsmaeder I have updated the sample and description.

@tsmaeder
Copy link
Contributor

@sunix where do you see "Task: Configured tasks ... > Configure new Task > Others"? Is this a menu? Do you open the command palette? Both paths don't lead to anything for me in Theia master.

@sunix
Copy link
Contributor Author

sunix commented Jun 18, 2021

command palette yes theia master

Development Host - theiadev_projects - Google Chrome_402
Development Host - theiadev_projects - Google Chrome_405
Development Host - theiadev_projects - Google Chrome_406
Development Host - theiadev_projects - Google Chrome_407

@tsmaeder
Copy link
Contributor

I don't see "Configure new task..." when I execute "Configure Task...", just a list of tasks.

@sunix
Copy link
Contributor Author

sunix commented Jun 18, 2021

@tsmaeder scroll down

@tsmaeder
Copy link
Contributor

The problem really seems to be that when you do "vscode.tasks.fetchTasks()", you get back an object that has

reveal: 'always',

in its presentation, when in fact it should be an integer-value enum.

@sunix
Copy link
Contributor Author

sunix commented Jun 18, 2021

@tsmaeder
Copy link
Contributor

Methinks the conversion in TasksMainImpl#fetchTasks() is broken: it does not convert the presentation options to the correct type in the TaskDTO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted issues meant to be picked up, require help tasks issues related to the task system vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants