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

access tasks configs as preferences #6268

Merged
merged 1 commit into from
Sep 29, 2019
Merged

access tasks configs as preferences #6268

merged 1 commit into from
Sep 29, 2019

Conversation

elaihau
Copy link
Contributor

@elaihau elaihau commented Sep 26, 2019

  • In current Theia, the task extension is responsible for reading,
    writing, and watching tasks.json files. With this change, the task
    extension does not access tasks.json files directly, and leaves the
    work to the preference extension.
  • resolves tasks configs as preferences #5013

How to test

There are no changes in terms of functionalities. Therefore, to verify this change, we would need to go through the use cases that are already supported by Theia, and check if they are still properly functional. Those use cases include but not limit to:

As a Theia user I am able to

  • run tasks defined in tasks.json
  • run detected tasks contributed by Theia plugins
  • run detected tasks contributed by Theia extensions (Please note, this is broken on master branch and reported in cpp build task does not work #6204)
  • configure tasks defined in tasks.json
  • configure detected tasks (Please note, "configuring tasks" by clicking the gear icons in tasks' quick open menu is broken on master branch and reported in Can not configure a task from Terminal => Run Task menu  #6212. In order to test this feature we would have to use the top menu bar Terminal -> Configure Tasks ...)
  • see the recently used tasks be grouped together and show up at the top of the tasks' quick open menu
  • see the "detected tasks" displayed as "configured tasks", if they are configured / customized in the tasks.json
  • see the problem matcher items show up in the prompt, if a task that is not associated with any problem matchers is started
    • and see the selected problem matcher item written into tasks.json
  • do all the items described above in both single root and multi root workspace.

@elaihau elaihau force-pushed the Liang/task_pref branch 3 times, most recently from ec7a447 to 8f66f5a Compare September 26, 2019 22:49
@akosyakov akosyakov added preferences issues related to preferences tasks issues related to the task system labels Sep 27, 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.

Awesome changes! Code looks very good besides minor remarks.

From user perspective: content assist does not work in tasks.json regardless whether I create it in .theia or .vscode folder.

packages/task/src/browser/task-configuration-model.ts Outdated Show resolved Hide resolved
packages/task/src/browser/task-configuration-manager.ts Outdated Show resolved Hide resolved
packages/task/src/browser/task-configuration-manager.ts Outdated Show resolved Hide resolved
packages/task/src/browser/task-configurations.ts Outdated Show resolved Hide resolved
packages/task/src/browser/task-configurations.ts Outdated Show resolved Hide resolved
packages/task/src/browser/task-configurations.ts Outdated Show resolved Hide resolved
@akosyakov
Copy link
Member

akosyakov commented Sep 27, 2019

@RomanNikitenko @vince-fugnitto if you do smoke testing it would help too, just to be safe, i.e. with some VS Code extensions. You should be able to define now tasks.json in .vscode or .theia folder and in settings.json under tasks attribute as well.

@elaihau
Copy link
Contributor Author

elaihau commented Sep 27, 2019

Thank you for the review Anton !
I addressed the comments, and will test if task configs can be defined in preferences. Never thought of trying with this change :)

@akosyakov
Copy link
Member

@elaihau more important that it can be loaded from .vscode, from settings.json is probably very rare

model.onDispose(() => this.models.delete(key));
this.models.set(key, model);
}
this.onDidChangeTaskConfigEmitter.fire({ uri: key, type: FileChangeType.UPDATED });
Copy link
Member

@akosyakov akosyakov Sep 27, 2019

Choose a reason for hiding this comment

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

It should happen only in if branch, if model already exists then we don't need to fire update event

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.

Code changes looks good to me just please have a look at https://github.com/eclipse-theia/theia/pull/6268/files#r328968945

I can define and run tasks now under .vscode as well, content assist is there.

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 the following functionality in Theia:

Use Case Status
run task without selecting a problem matcher 👍
run task selecting 'never ask'
(this successfully writes "problemMatcher": [] in the tasks.json
👍
run task which has [] as a problem matcher
(does not prompt me again)
👍
run task selecting a problem matcher
(this successfully writes the problem matcher in the tasks.json
👍
run task which has a problem matcher
(does not prompt me again)
👍
verify recently used tasks are present in the run task quick-open 👍
verify if clearing recently used tasks removes recently used tasks from the quick-open 👍
verify if configure tasks works 👍
verify if run last task works 👍
verify if show running tasks works 👍
.vscode/tasks.json has content assist 👍
able to define and run tasks from the .vscode/tasks.json
(might be an error on my part, to be confirmed)
\
multi-root works 👍

- In current Theia, the task extension is responsible for reading,
writing, and watching `tasks.json` files. With this change, the task
extension does not access `tasks.json` files directly, and leaves the
work to the preference extension.
- resolves #5013

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

elaihau commented Sep 28, 2019

@vince-fugnitto thank you for the review, really apprecited !

I tested the scenario where task configs are defined in .vscode/tasks.json

Peek 2019-09-28 12-23

@vince-fugnitto
Copy link
Member

@vince-fugnitto thank you for the review, really apprecited !
I tested the scenario where task configs are defined in .vscode/tasks.json

I confirmed that it also works for me to define tasks under .vscode/tasks.json.
I however attempted to have both .vscode and .theia tasks and could not (only sees the .theia tasks). This is likely to be the expected behavior but I was not sure.

@elaihau
Copy link
Contributor Author

elaihau commented Sep 29, 2019

I confirmed that it also works for me to define tasks under .vscode/tasks.json.
I however attempted to have both .vscode and .theia tasks and could not (only sees the .theia tasks). This is likely to be the expected behavior but I was not sure.

yep i believe what you described was from Anton's code:

/* prefer Theia over VS Code by default */
and I think it's expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preferences issues related to preferences tasks issues related to the task system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tasks configs as preferences
3 participants