-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
support creating tasks.json from template #6391
Conversation
@elaihau Are there corresponding docs how does it work in VS Code? |
@akosyakov I followed the descriptions in this page https://code.visualstudio.com/Docs/editor/tasks#_custom-tasks Of course, the online doc doesn’t document all the details. I experimented in vs code to figure out what should be done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed if no .theia/tasks.json
exists, if we run the following configure tasks...
, the .theia/tasks.json
is already created before we select a template option. If a user cancels, they will be left with an empty tasks.json
. Should we not instead wait until a choice is made before creating the file like VS Code?
See bellow for screenshare:
@elaihau I like that we are smarter than VS Code in the case of multi-root where we prompt users to select a default template for a given root. 👍 VS Code only adds to the first root. I'm not sure if we should keep the |
I've tested the following functionality:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello!
Could you clarify the behavior:
When tasks.json does not exist in the root folder, "Create tasks.json file from template" should show up as an option, and users should be prompted to select which template to to generate the tasks.json from
I don't have tasks.json
file, but I have detected
tasks - should be displayed option "Create tasks.json file from template" for this case?
https://youtu.be/i0UbIGgdK0s
I tested for multi root workspace for 2 projects. I guess the problem can be on my side, do you have idea about cause of this problem? |
@RomanNikitenko Theia decides based on there you have |
@akosyakov @elaihau
It works for me after refreshing page only |
I also tested the multi-workspace. When I add a new folder to workspace, "Configure Task" does NOT create the file "tasks.json" until I refreshed the front-end with this new workspace folder in it, then using the task "Configure Tasks" creates the file under .theia or .vscode (if settings.json exists under the folder) open some project |
@RomanNikitenko
I also updated the commit message and PR description to the following:
What Anton said was correct.
Thank you for the review and testing, really apprecited ! |
82eead1
to
d9404ae
Compare
wow nice catch ! I updated the code to support the scenario where no templates is chosen. While working on the update I found the Thank you for the review and the test ! @vince-fugnitto |
There was a problem hiding this 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 after update:
- tasks are grouped by the roots for
Terminal => Configure Tasks
Create tasks.json file from template
is displayed if there are no detected tasks andtasks.json
file does not existTerminal => Configure Tasks
works correctly iftasks.json
file doesn't exist but detected tasks are presentOpen tasks.json file
is displayed iftasks.json
file exists and no configured tasks are found- can not reproduce support creating tasks.json from template #6391 (comment)
d9404ae
to
8bf6e59
Compare
Thank you for spending time with me on Friday. @vince-fugnitto Thanks ! |
- group the tasks by workspace folder in the quick open item list populated by "Terminal" -> "Configure Tasks..." - when "Configure Tasks" is started, check if tasks.json exists: - "Create tasks.json file from template" is displayed if 1) there are no detected or configured tasks, and 2) tasks.json does not exist - "Open tasks.json file" is displayed, if 1) tasks.json exists, and 2) no detected or configured tasks are found. - add VS Code Task templates to Theia. CQ created http://dev.eclipse.org/ipzilla/show_bug.cgi?id=20967 - part of #4212 Signed-off-by: Liang Huang <liang.huang@ericsson.com>
8bf6e59
to
fad9056
Compare
Thank you for the feedback @akosyakov your comments have been address in the lastest update. I am still waiting for the CQ to get approved - is there a way to speed up the process ? |
} | ||
} | ||
for (const taskConfigs of grouped.values()) { | ||
taskConfigs.sort((t1, t2) => t1.label.localeCompare(t2.label)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, for case when tasks.json
contains invalid configuration without label
Terminal => Configure Tasks
can not be open without any messages to inform user about the cause, only error in browser console is displayed
You can use the following configuration to reproduce it:
{
"type": "shell",
"command": "sleep 2 && echo test",
"problemMatcher": []
}
I think it can be fixed within #6482
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for pointing it out ! I am working on this bug as part of 6482 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code wise looks good now, please rely on @RomanNikitenko approve for testing
Signed-off-by: Liang Huang liang.huang@ericsson.com
How to test
In a multi root workspace, quick open items of "Tasks: Configure Tasks" (or "Terminal -> Configure tasks") should be grouped by the names of root folders
When tasks.json does not exist in the root folder, "Create tasks.json file from template" should show up as an option, and users should be prompted to select which template to to generate the tasks.json from
If a non-empty tasks.json exists and there are no configured or detected tasks in the root folder, "Open tasks.json file" should show up as an option. Clicking that option opens the tasks.json by the editor.
Review checklist
as an author, I have thoroughly tested my changes and carefully followed the review guidelines
CQ http://dev.eclipse.org/ipzilla/show_bug.cgi?id=20967 approved