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

[tasks] add the display of configured tasks when executing 'configure tasks...' #5472

Merged
merged 1 commit into from
Aug 15, 2019

Conversation

vince-fugnitto
Copy link
Member

@vince-fugnitto vince-fugnitto commented Jun 14, 2019

What it does

Fixed #5468

  • added configured tasks when executing the command and menu item for configure tasks...
  • previously, only provided tasks where being displayed which is inconsistent with VSCode
  • better multi-root support for configured tasks (display the root as a description in the quick-open)
  • ensure that provided and configured tasks are unique (no duplicates found, configured and duplicate tasks should not overlap)

How to test

  • use the npm vscode-builtin-extension plugin when testing
  • open a workspace (ex: `theia/packages/console)
  • execute the command Run Task..., notice the correct source npm for the tasks
  • execute the command Configure Task, notice the same correct source npm for tasks
  • with the Configure Task quick-open menu present, configure a task (this should open the tasks.json file with a new entry
  • execute the command Run Task... and verify the newly configured task is found under 'configured' tasks
  • excute the command Configure Task, only one entry for the previously configured task should be present
  • repeat the steps for a multi-root workspace

Review checklist

Reminder for reviewers

Signed-off-by: Vincent Fugnitto vincent.fugnitto@ericsson.com

@vince-fugnitto vince-fugnitto added enhancement issues that are enhancements to current functionality - nice to haves tasks issues related to the task system labels Jun 14, 2019
@vince-fugnitto vince-fugnitto force-pushed the vf/GH-5468 branch 3 times, most recently from 9963b15 to 1d1c2b1 Compare June 17, 2019 17:01
@vince-fugnitto
Copy link
Member Author

Just force-pushed to re-trigger the Gitpod build :)

@elaihau
Copy link
Contributor

elaihau commented Jun 17, 2019

Did a quick test.

  • it worked properly when I opened a folder as my workspace, however
  • it didn't not work in the multi root setting.

@vince-fugnitto
Copy link
Member Author

Did a quick test.

  • it worked properly when I opened a folder as my workspace, however
  • it didn't not work in the multi root setting.

I'll try on master, perhaps it never worked in a multi-root use case since it doesn't know where to look for the tasks.json :(

this.items.push(new QuickOpenItem({
label: 'No tasks found',
run: (_mode: QuickOpenMode): boolean => false
}));
}

providedTasks.forEach(task => {
[...configuredTasks, ...providedTasks].forEach(task => {
Copy link
Contributor

@RomanNikitenko RomanNikitenko Jun 17, 2019

Choose a reason for hiding this comment

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

I think about use case when at first user has some detected task, then user configures the task.
Will 'Configure Tasks' action display both tasks after that?
So two tasks with the same label will be displayed.
Is it expected behavior?

Copy link
Member Author

Choose a reason for hiding this comment

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

@RomanNikitenko what do you believe is the correct behavior?
The configure tasks... menu should display all configured tasks, and provided (detected tasks) which have yet to be configured?

This means if the provided task is configured, it'll no longer show in the menu as detected?

Copy link
Contributor

Choose a reason for hiding this comment

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

vscode doesn't display both configurations for this case.
"Run Task" menu of Theia displays only configured configuration if both are present (configured and detected)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! I'll wait for your PR #5313 to resolve before continuing.

@RomanNikitenko
Copy link
Contributor

Did a quick test.

  • it worked properly when I opened a folder as my workspace, however
  • it didn't not work in the multi root setting.

I'll try on master, perhaps it never worked in a multi-root use case since it doesn't know where to look for the tasks.json :(

Unfortunately you are right #4919

@elaihau
Copy link
Contributor

elaihau commented Jul 24, 2019

this one should be unblocked once #5777 is merged.

@vince-fugnitto
Copy link
Member Author

this one should be unblocked once #5777 is merged.

Sounds good @elaihau, once #5777 is merged I'll revisit this PR again to re-confirm if it works and update it if required :)

@vince-fugnitto
Copy link
Member Author

@elaihau I've rebased the PR to take advantage of the changes you made :)
Do you mind re-testing for me?

@RomanNikitenko
Copy link
Contributor

I tested the changes after updating the PR.
Looks like type, not source field is used at displaying of configurations

actual_tasks

Before the changes:
configure_before

@vince-fugnitto
Copy link
Member Author

Looks like type, not source field is used at displaying of configurations

@RomanNikitenko thank you for reviewing, I now perform the same operation to determine the label as the TaskRunQuickOpenItem.

@RomanNikitenko
Copy link
Contributor

@vince-fugnitto
I see that you updated the PR, but for me the items are displayed in the same way as before updating. Please see the video: https://youtu.be/FodCrEOrtw0

Is it something wrong with my assembly?
Could you check it?
Thank you!

@vince-fugnitto
Copy link
Member Author

I see that you updated the PR, but for me the items are displayed in the same way as before updating.

@RomanNikitenko thank you for pointing it out to me! I've updated the code and now get the following behavior:

image

packages/task/src/browser/quick-open-task.ts Show resolved Hide resolved
@@ -321,7 +324,9 @@ export class TaskConfigureQuickOpenItem extends QuickOpenGroupItem {
}

getLabel(): string {
return `${this.task._source}: ${this.task.label}`;
return this.task._source
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess for a configured task the name of the root folder will be used for displaying.
Please see here
Is it expected behavior?

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean if you add some configuration to tasks.json file:

{
      "label": "Run my test task",
      "type": "shell",
      "command": "./task-long-running"
    }

For Configure Tasks the task is displayed :
configured_tasks_error

For Run Task the same task is displayed:
run_tasks

@RomanNikitenko
Copy link
Contributor

RomanNikitenko commented Aug 6, 2019

@vince-fugnitto
Could you test the case described here to avoid of displaying tasks with the same label twice

double_tasks

@vince-fugnitto
Copy link
Member Author

@RomanNikitenko sure thank you for pointing it out, I'll investigate it more closely.

@vince-fugnitto
Copy link
Member Author

I'm still not happy with the support present in a multi-root workspace.
The items should be grouped by root, have a groupLabel present, and have a divider.

Currently

Screen Shot 2019-08-07 at 11 48 33 AM

VSCode

Screen Shot 2019-08-07 at 10 22 25 AM

@vince-fugnitto vince-fugnitto force-pushed the vf/GH-5468 branch 2 times, most recently from 0022aa6 to 7ab3104 Compare August 7, 2019 16:38
@vince-fugnitto
Copy link
Member Author

@elaihau do you mind reviewing the PR for me when you get the chance?

) {
super();
const stat = this.workspaceService.workspace;
this.isMulti = stat ? !stat.isDirectory : false;
Copy link
Member

Choose a reason for hiding this comment

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

you should not cache such things, but always compute them from WorkspaceService to make sure that you read up-to-date state, please review others places in the PR

Generally try to have a single source for the some state and read it from there, don't replicate it. Replication sometimes helpful, usually between processes, but introduces with keeping replica in sync and invalidating it properly.

Copy link
Member

Choose a reason for hiding this comment

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

WorkspaceService has isMultiRootWorkspaceOpened, just call it everywhere

@akosyakov
Copy link
Member

@vince-fugnitto is not clear from the description how to test, please align with our template and assign more people for review

Fixed #5468

Added `configured` tasks when executing the command and menu item for `configure tasks...`.
Previously, only `provided` tasks were displayed which is inconsistent with vscode, and our
own implementation present in the command `run task...` which permits configuring all tasks using the `configure` icon. In order to be consistent, and align with vscode and our own
implementations, `configured` tasks should also be added to the menu.

Triggering the `configure` for any given task opens the `task.json`.

- fixed the deprecated import statements
- fixed the deprecated unused injection.

Signed-off-by: Vincent Fugnitto <vincent.fugnitto@ericsson.com>
@vince-fugnitto
Copy link
Member Author

@vince-fugnitto is not clear from the description how to test, please align with our template and assign more people for review

Thanks, I update the PR description based on the new template.

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 extension:

  • configured tasks are displayed correctly: comment is fixed
  • the case described here is fixed
  • configured and detected tasks are displayed for Configure Tasks action
  • tried the cases for multi-root workspace

It works well for me! @vince-fugnitto thank you!

@lmcbout
Copy link
Contributor

lmcbout commented Aug 13, 2019

Tested only the single root for now, I found the following when using the procedure "How to test" describe above:
If I delete the file: .theia/task.json --> the task remain in "Configure task" not in "detected task" unless I reload the Front-end

  • When the file "task.json" is deleted, unable to recreate the file with Configure task unless I reload the Front-end

@vince-fugnitto
Copy link
Member Author

Tested only the single root for now, I found the following when using the procedure "How to test" describe above...

That is a behavior currently present in master and is not addressed in the scope of the PR.

@lmcbout
Copy link
Contributor

lmcbout commented Aug 13, 2019

Question:
When we already have some "Task" configured, should we show the list of "Task" as "Configured" and "Detected" when opening the dialog? Or may be have a separator between the already "configured" and the "detected" task ?

@vince-fugnitto
Copy link
Member Author

When we already have some "Task" configured, should we show the list of "Task" as "Configured" and "Detected" when opening the dialog? Or may be have a separator between the already "configured" and the "detected" task ?

I assume you mean when executing the Configure Task command which triggers the quick-open menu. VSCode does not display a separator between configured and detected tasks in this menu.

@lmcbout
Copy link
Contributor

lmcbout commented Aug 13, 2019

I assume you mean when executing the Configure Task command which triggers the quick-open menu. VSCode does not display a separator between configured and detected tasks in this menu.

Yes in the Configure Task quick-open menu. I just tested with VSCode, you are right, but still I think a separator would make it better

@elaihau
Copy link
Contributor

elaihau commented Aug 15, 2019

I tested the following things:

  • both configured and detected tasks can be configured
  • no duplications in tasks.json if a detected task is configured twice or more
  • recent tasks can be configured
  • works properly in a multi root workspace

Copy link
Contributor

@elaihau elaihau left a comment

Choose a reason for hiding this comment

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

Thank you for the work !

@vince-fugnitto
Copy link
Member Author

Thank you @RomanNikitenko @elaihau for the review.

@vince-fugnitto vince-fugnitto merged commit e8a29ca into master Aug 15, 2019
@vince-fugnitto vince-fugnitto deleted the vf/GH-5468 branch August 15, 2019 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement issues that are enhancements to current functionality - nice to haves tasks issues related to the task system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[tasks] update 'configure tasks' command and menu
5 participants