-
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
handles invalid task configurations #6515
Conversation
0912e85
to
e272f70
Compare
What VS Code does? Usually it is more tolerant and will ignore unnecessary or bogus properties. Please check. |
vs code does something similar ... and they have such mechanism to validate "input" properties as well. Just want to clarify, being tolerant on bogus properties or not being tolerant depends on how the task schema is defined. So in this commit my main focus was comparing the Theia schema agaist that one in vs code. The part I am missing in this PR is "directing the validation errors into the Output View", and I am trying to improve it in that aspect. |
I think it is a good start to show a dialog with some info, but it goes away. I find what VSCode do is better by having the dialog, but also with a button to open the "Output" view with more details about the invalid task. If the end-user doesn't have the "problem " view open in Theia, it is harder to see the reason why the task is not showing in he quick-open menu. The "Problem" view is not always visible when you modify the task.json file. |
Thank you for the feedback ! @lmcbout
Question is which tasks.json to open, if there are invalid task configs in multiple files? |
Would be nice to open task.json and the problem view, but we also need to point to the faulty task (at least for the first faulty task) if there are more than one. |
What about opening the output view with all the faulty tasks if there are more than one and open the tasks.json with the first error in it with the problem view ? |
If the
I'm not sure we need to over-engineer the solution, I think properly handling invalid task configs like @elaihau has been doing is great. |
hmm, i can work on the part that opens the Once that's implemented I can upload a GIF to demo what it looks like, and we could discuss if opening the Output View makes the solution more user friendly. |
@elaihau I don't think it needs to be overcomplicated for the moment. Informing users that they may have one or more task configs which are invalid due to missing properties is sufficient. An end user knows where the |
In the future we can have a new channel for the |
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'm fine with the following changes 👍
Task configurations which are invalid are not displayed when attempting to run them, the editor
and problems-view
correctly display makers, and users are informed that the tasks.json
may have errors.
const schema = this.taskSchemaUpdater.getTaskSchema(); | ||
const ajv = new Ajv(); | ||
const validateSchema = ajv.compile(schema); | ||
const isValid = !!validateSchema({ tasks: [task] }); |
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.
[minor] I believe we can simply
return !!validateSchema({ tasks: [task] });
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.
resolved. Thank you for your review !
b942c02
to
9a3b5c2
Compare
@lmcbout if the |
9a3b5c2
to
51b011d
Compare
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.
Tested for shell
and typescript
tasks:
- a task is not displayed if its configuration is invalid
- a task is displayed after fixing its configuration
- warning informs user about invalid configuration
- there is ability to open the corresponding
tasks.json
file by clicking onOpen
button of warning message if config file is closed
Works well for me!
btw: should we remove warning for version
property?
I mean case when user opens some existed project with tasks.json
file which was created using vs code.
Yes you are right. I will update the schema. Thank you for the review ! |
- not display the invalid task configurations in the list of tasks. - displays a warning message to inform users if Theia finds invalid task configuration(s) in tasks.json. - fixes #6482 Signed-off-by: Liang Huang <liang.huang@ericsson.com>
51b011d
to
35aebc1
Compare
configuration(s) in tasks.json.
Signed-off-by: Liang Huang liang.huang@ericsson.com
How to test
As the GIF shows,
enter an invalid task configuration into tasks.json.
FYI, it would be helpful to keep the Problem View open, as it would display the schema errors Theia finds from task configuration. With the information from the Problems View, we know if we are truely entering an invalid config.
Open the list of tasks from the top menu bar "Termimal -> Run Tasks"
At this point of time, the list of tasks should NOT have the task config that was entered most recently, because it's invalid. Also, there should be a warning populated that reminds us to open the Problems view to get what the errors are.
Go back to tasks.json and fix the invalid configuration
After the config is fixed, it should show up as one item in the list of tasks.
Review checklist