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

notify clients of TaskDefinitionRegistry on change #5915

Merged
merged 1 commit into from
Aug 20, 2019

Conversation

elaihau
Copy link
Contributor

@elaihau elaihau commented Aug 11, 2019

  • In current theia, task definitions from plugins are registered after the initialization of the task extension, causing task-loading, which counts on the existence of task definitions, not to function correctly. With changes in this pull request, events are emitted so that the clients of TaskDefinitionRegistry are notified and therefore have the flexibility to re-organize the loaded tasks.

Signed-off-by: Liang Huang [email protected]

How to test

  1. Have a detected task prepared.
  • What I did in this step is having npm extension installed in Theia, and adding at least one npm script, so that the project has a few detected npm tasks. Reload Theia frontend (example-browser).
  1. Customize one detected task by adding an object in tasks.json, e.g.,
        {
            "type": "npm",
            "script": "lint",
            "problemMatcher": [
                "$eslint-stylish"
            ]
        }
  1. Run the customized task.

What happened: the problem matcher, although defined in tasks.json, does not parse the task output, and therefore warnings and errors of the task did not show up in the problems view

What should happen: warnings and errors of the task, if any, should be displayed as markers in the problems view

Review checklist

@elaihau elaihau requested a review from a team as a code owner August 11, 2019 15:06
@elaihau elaihau requested a review from paul-marechal August 11, 2019 15:09
@elaihau
Copy link
Contributor Author

elaihau commented Aug 11, 2019

Without this change, #5877 and #5024 are broken by recent changes in theia

@akosyakov akosyakov added the tasks issues related to the task system label Aug 12, 2019
@elaihau elaihau force-pushed the Liang/fix_task_def_load branch from 27fd75b to 99a31e4 Compare August 17, 2019 16:47
@elaihau elaihau changed the title add 'ready' status to TaskDefinitionRegistry notify clients of TaskDefinitionRegistry on change Aug 17, 2019
Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Design-wise it looks good, someone has to verify the behaviour. cc @theia-ide/task-extension

packages/task/src/browser/task-definition-registry.ts Outdated Show resolved Hide resolved
packages/task/src/browser/task-definition-registry.ts Outdated Show resolved Hide resolved
packages/task/src/browser/task-configurations.ts Outdated Show resolved Hide resolved
@akosyakov akosyakov requested a review from a team August 18, 2019 07:06
@elaihau elaihau force-pushed the Liang/fix_task_def_load branch from 99a31e4 to a520f99 Compare August 18, 2019 15:26
@elaihau
Copy link
Contributor Author

elaihau commented Aug 19, 2019

@vince-fugnitto @marechal-p this change is ready for review and test. could you please take a look when you get the chance? THank you !

@vince-fugnitto
Copy link
Member

@elaihau

I noticed something a little odd while testing, when executing the command Run Task... I only see one configured task, while if I open my tasks.json I see two:

Peek 2019-08-19 07-48

Perhaps I am doing something wrong, I didn't quite understand how to properly test the PR.

@elaihau
Copy link
Contributor Author

elaihau commented Aug 19, 2019

Hmmm, let me try the same. Probably there is a bug here. Thank you Vincent.

@elaihau elaihau force-pushed the Liang/fix_task_def_load branch from a520f99 to fbcee76 Compare August 20, 2019 04:04
@elaihau
Copy link
Contributor Author

elaihau commented Aug 20, 2019

@vince-fugnitto you tested it in the right way :)
it was a problem in the logic of filtering out duplicates. I fixed it and refactored the code.

Peek 2019-08-20 00-10

@vince-fugnitto
Copy link
Member

@elaihau do you mind sharing your example project in which you had the npm lint and problem marker defined?

@elaihau
Copy link
Contributor Author

elaihau commented Aug 20, 2019

@vince-fugnitto yes https://send.firefox.com/download/f6550506fa184dea/#53ypwivg9tNAKUVfa6DHiA

the link is good for 5 downloads today

@vince-fugnitto
Copy link
Member

@vince-fugnitto yes https://send.firefox.com/download/f6550506fa184dea/#53ypwivg9tNAKUVfa6DHiA

the link is good for 5 downloads today

Thank you! I'll test it shortly :)

@elaihau elaihau force-pushed the Liang/fix_task_def_load branch from fbcee76 to 8f4f519 Compare August 20, 2019 11:45
- In current theia, task definitions from plugins are registered after the initialization of the task extension, causing task-loading, which counts on the existence of task definitions, not to function correctly. With changes in this pull request, events are emitted so that the clients of TaskDefinitionRegistry are notified and therefore have the flexibility to re-organize the loaded tasks.

Signed-off-by: Liang Huang <[email protected]>
@elaihau elaihau force-pushed the Liang/fix_task_def_load branch from 8f4f519 to f1ce203 Compare August 20, 2019 11:46
Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested using the example workspace you provided.

In my tasks.json I have the following task with the $eslint-stylish problemMatcher:

{
    "tasks": [
        {
            "type": "npm",
            "script": "lintAAA",
            "problemMatcher": [
                "$eslint-stylish"
            ]
        }
    ]
}

After running the task I can see the markers being populated in the problems-view:

image

@elaihau
Copy link
Contributor Author

elaihau commented Aug 20, 2019

Thank you Vincent!

@elaihau elaihau merged commit c17f0db into master Aug 20, 2019
@elaihau elaihau deleted the Liang/fix_task_def_load branch August 21, 2019 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tasks issues related to the task system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants