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

use task definition as a reference to compare tasks #5975

Merged
merged 1 commit into from
Aug 28, 2019

Conversation

elaihau
Copy link
Contributor

@elaihau elaihau commented Aug 18, 2019

  • Although task users have much flexibility to define tasks through
    contributing to the Task definitions, TaskConfiguration.equals() and
    ContributedTaskConfiguration.equals() compare certain properties of task
    configs, and thus are not reliable enough. With changes in this pull
    request, Theia uses task definitions as a reference to decide which
    properties in task configs should be considered in comparison.
  • fixed Incorrect displaying of configured task after refreshing page #5878

Signed-off-by: Liang Huang liang.huang@ericsson.com

How to test

Peek 2019-08-18 00-47

  • Use npm extension
  • Configure one or more npm tasks, and refresh page
  • Go to Terminal -> Run Task menu to check if the configured task(s) are displayed correctly
  • Check if the configured task(s) can be run

Review checklist

@elaihau elaihau requested a review from a team as a code owner August 18, 2019 04:51
@akosyakov akosyakov added the tasks issues related to the task system label Aug 18, 2019
@akosyakov akosyakov requested a review from a team August 18, 2019 07:06
@elaihau elaihau changed the title [DRAFT] use task definition as a reference to compare tasks use task definition as a reference to compare tasks Aug 21, 2019
@elaihau
Copy link
Contributor Author

elaihau commented Aug 21, 2019

@theia-ide/task-extension @theia-ide/plugin-system
This pull request is ready for review.

Copy link
Contributor

@RomanNikitenko RomanNikitenko left a comment

Choose a reason for hiding this comment

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

Hello!
I tested the changes and can not reproduce the issue #5878
thank you!

but I faced with another problem, please see video
before changes: https://youtu.be/VCCnIkjE9vQ
after changes: https://youtu.be/RFB3bkZn-tk

So:

  • displaying of a typescript task is different
  • I can not get output for a typescript task

Could you check it?
thanks in advance!

@elaihau
Copy link
Contributor Author

elaihau commented Aug 22, 2019

Thank you for your time! I will check what I did wrong.

@elaihau
Copy link
Contributor Author

elaihau commented Aug 23, 2019

Hello!
I tested the changes and can not reproduce the issue #5878
thank you!

but I faced with another problem, please see video
before changes: https://youtu.be/VCCnIkjE9vQ
after changes: https://youtu.be/RFB3bkZn-tk

So:

  • displaying of a typescript task is different
  • I can not get output for a typescript task

Could you check it?
thanks in advance!

@RomanNikitenko I checked the latest master 06346e5 and found it populated the same error when running the tsc.
The error came from terminal extension, and looked related to #3791

I am curious which version of Theia you used to make the first video ? Could you please help me check?

@RomanNikitenko
Copy link
Contributor

@elaihau

@RomanNikitenko I checked the latest master 06346e5 and found it populated the same error when running the tsc.

For detected tsc task - yes, but not for the configured tsc task.
I have no answer why configured tsc task is working , but detected tsc task is not working for master branch. I need to investigate what's difference. But for your branch configured tsc task is not working for me.
Could you try to configure a tsc task and try to run for master branch and for you branch.

I am curious which version of Theia you used to make the first video ?

I guess you tried to run detected task, please try to run configured task.
I can run configured task and get output for the latest master aa00fe7
Please see video and let me know if you can not reproduce it: https://youtu.be/pbEQJtVALIQ

thank you!

@elaihau elaihau force-pushed the Liang/new_task_compare branch 2 times, most recently from 0ce0e93 to 56c44db Compare August 25, 2019 04:21
@elaihau
Copy link
Contributor Author

elaihau commented Aug 25, 2019

@RomanNikitenko thank you for all the details ! yes i can finally reproduce the problem.

The latest version of my code in this pull request should have fixed it. Not only the "configured tsc" but also the "detected tsc" can be started from Theia.

Please take a look when you get the chance, and kindly let me know if you have any suggestions.

Thanks !

Copy link
Contributor

@RomanNikitenko RomanNikitenko left a comment

Choose a reason for hiding this comment

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

@elaihau
Hello!
I tested the PR changes after update and can confirm that:

Do we have some reasons to change displaying of typescript tasks?
I mean that typescript tasks for Terminal -> Run Task menu are displayed:

run_typescript

For Configure Tasks:
configure_typescript

For VS Code:
vs_code_run_typescript

So the behavior for Configure Tasks is closer to VS Code behavior than for Run Task.
I guess it's related to changes for TaskRunQuickOpenItem.
For TaskConfigureQuickOpenItem as label still this way is used.

It works well for me, thank you, just to know if we have some reasons to change way of displaying items...

@elaihau
Copy link
Contributor Author

elaihau commented Aug 27, 2019

@RomanNikitenko
the task labels are displayed correctly, however the tasks are not sorted properly

  • is this what you suggested in the comment?

I quickly looked at the code and found we don't have extra sorting logic for the displayed tasks in the quick open. the reason I changed the task label is that, the "task type" could possibly be overwritten after task resolution, and "tsc: run" would be displayed as "shell: run" after the task is run once.

I could create a separate issue in github and address it in a separete pull request. are you OK with that? After all, the sorting might be a little beyond the scope the #5878

@RomanNikitenko
Copy link
Contributor

@elaihau
I mean that labels for typescript tasks are displayed:

  • typescript:build - tsconfig.json for Run Task
  • tsc:build - tsconfig.json for Configure Tasks
  • tsc:build - tsconfig.json for VS Code

So the question is - why do we display it like typescript: build for Run Task instead of tsc:build

@elaihau
Copy link
Contributor Author

elaihau commented Aug 27, 2019

@RomanNikitenko wow thank you for finding it out and pinpoint the root cause.

I can revert my changes to getLabel() to make sure task labels are consistent.

I will create a separate GH issue for the problem I described.

@RomanNikitenko
Copy link
Contributor

@elaihau
The displaying of tsc tasks are fixed after update.

Could you try the following case:

  1. Configure a npm task
  2. Run the configured task.
  3. Go to Run Task :

You can see that recently used section is absent and the task is in the configured section, not in the recently used section.

  1. Refresh page and rerun the same task
  2. Go to Run Task :

You can see that the task in the recently used section, but looks like:
rec_used_bug

Please see the video: https://youtu.be/DixaBLnl1M8

Can you reproduce it? Should I create the separate issue for the case?

@elaihau
Copy link
Contributor Author

elaihau commented Aug 27, 2019

Yes I am aware of this problem. And that is why I changed getLabel() function in the quick-open-task.ts.

The problem comes from the vscode extension typescript-language-features, where the type of tasks is “tsc” in the Task instantiation, while the type in the task definition is “typescript”.

Therefore, if I want the tsc tasks to be added to the “recently run”, we have inconsistent labels. And if we want consistent labels in the display, they are not added to the “recently run”. It’s really annoying.

Luckily enough, this only happens to detected tasks from “typescript-language-features”. The ones from npm and grunt are not impacted.

Maybe I should take a deeper look into this problem. If you have time please create an issue in GitHub and I will tackle it after the “fetchTask()” pull request.

**With all the given information, do you prefer “tsc build” or “typescript build” in the quick open ? **

“tsc build” is consistent with vscode with the bug you described, whereas “typescript build” is inconsistent with vscode.

Your comments are really helpful. Thank you!

@elaihau
Copy link
Contributor Author

elaihau commented Aug 27, 2019

Let’s keep this pull request open. I prefer to fix it in this one instead of leaving it to the future :)

@RomanNikitenko
Copy link
Contributor

**With all the given information, do you prefer “tsc build” or “typescript build” in the quick open ? **

Do you mean - we don't have the problem described here if we have your changes for getLabel()?
If so - personally I think it's better to have inconsistent labels for one extension to avoid the bug.

In general, when I do review I don't have the goal to block some PR - my goal is to identify the potential problems before merge some changes. Then the author, reviewers, code owners can assess and discuss - should it be fixed within the current PR or we should create an issue for detected problem and fix it in separate PR.
So - I don't mind to have inconsistent labels for one extension to avoid the bug, but up to you!

- Although task users have much flexibility to define tasks through
contributing to the Task definitions, TaskConfiguration.equals() and
ContributedTaskConfiguration.equals() compare certain properties of task
configs, and thus are not reliable enough. With changes in this pull
request, Theia uses task definitions as a reference to decide which
properties in task configs should be considered in comparison.
- fixed #5878

Signed-off-by: Liang Huang <liang.huang@ericsson.com>
@elaihau
Copy link
Contributor Author

elaihau commented Aug 28, 2019

In general, when I do review I don't have the goal to block some PR - my goal is to identify the potential problems before merge some changes. Then the author, reviewers, code owners can assess and discuss - should it be fixed within the current PR or we should create an issue for detected problem and fix it in separate PR.

there is no misunderstanding here :) i think you have made all the comments in good faith, and i sincerely appreciate it.

I made more changes to my code, and tested with npm and typescript-language-feature. i believe the display problem has been fixed with my latest change. and "recently run tasks" should also be functional.

@RomanNikitenko
Thank you !

Copy link
Contributor

@RomanNikitenko RomanNikitenko 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 the changes using npm and tsc tasks after update:

  • I can not reproduce the bug Incorrect displaying of configured task after refreshing page #5878
  • I can run a tsc task as detected as well as configured - thank you very much for the fix for detected tsc task!
  • a task after running is placed in recently used section
  • after refreshing page label for a task looks correctly
  • labels for tsc tasks are consistent

@elaihau thank you for fix!

@elaihau
Copy link
Contributor Author

elaihau commented Aug 28, 2019

Thank you Roman 👍

@elaihau elaihau merged commit fce7783 into master Aug 28, 2019
@elaihau elaihau deleted the Liang/new_task_compare branch August 28, 2019 11:07
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.

Incorrect displaying of configured task after refreshing page
3 participants