-
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
Enable user-level task configurations #7620
Conversation
75b4063
to
be4f301
Compare
Rebased. |
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 the work.
I played with this change. One thing that I noticed was, with this change, the inputs
variables defined in the ~/.theia/tasks.json
can be used & overridden in my {workspaceFolder}/.theia/tasks.json
, while in vscode it is not the case.
in my opinion it is a better way of handling inputs
than vsCode.
One problem that I found was, the command Task: Open User Tasks
opens ~/.theia/tasks.json
in a new tab even if the same file has been opened.
the I don't quite understand what you describe here: can you give a concrete example?
I am using the "userstorage://" URI instead of a file URI. I think that is the correct thing to do abstractionwise and we don't really have a way to resolve that to a "real" URI on the front end. Open to suggestions here. |
I meant, with the following
I was able to run the task
I can even redefine vscode does not allow it. But i am not against you. i like your solution more. |
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 did a pass through the code and it looks good to me. VS Code compatibility tests were not changed and still passing. I will do some manual regression testing and check whether we need any records in CHANGELOG. It would be good that someone else tests whether user level task configurations work now.
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've tested debug launch configuration and could not find regressions.
I think changes also done clean. I am not sure that we need breaking changes. For user preferences adopters actually has to provide a custom implementation of UserStorageService
to store them somewhere else. This PR does not change it and still resolves all user configuration files via the user storage service.
Anyway @elaihau @RomanNikitenko It would be helpful if you look over the task extension improvemetns.
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.
Maybe the message in the prompt for user tests could be more user-friendly ?
This is my task config:
{
"type": "shell",
"label": "user test",
"command": "sleep 1 && pwd && echo ${input:arg1}"
},
- I am not sure where the
(1)
in the screenshot comes from - In a multi root workspace, we also display the root folder as part of the message. So in the message do we want to mention that it is a user test ?
|
Why do you think it's incorrect and what would the correct behaviour be in your opinion? I just tested this and it seems VS Code behaves the same way. In fact: as soon as I define an "inputs" section in the workspace folder, the inputs from the user level become undefined: it seems VS Code is using the normal preference override mechanism for inputs.
True dat! We should just open the user tasks resource at the corresponding place.
It seems the scope of the task is used here: the enumeration "TaskScope.User" has the value |
I fixed the source rendering and open user tasks when configuring a user task, as per @elaihau's comments. |
I tried in vs code one more time, and I DIDN'T see the value of the input variable defined in the root folder. As you can see from the GIF, in vscode, although {input:arg1} has the default value of "test arg 2" in my root folder, when i ran the user test the default was "test arg 1" In my opinion, the default value of input variable, if defined in a root folder, should only be used in that folder, not in the user tests. |
6a2356d
to
0944817
Compare
I don't agree with this one: one could define a global task that uses different inputs depending on the workspace folder. In any case, I don't see it as creating any problems, so I would move that we just leave that as it is. Did you check how this works in VS Code? |
Yes I did check how it works in VS Code. Please see my comment #7620 (comment) The GIF in that comment was also made from VS Code.
I see where you come from. But think about this scenario: In a multi root workspace composed of rootA and rootB
Which deault value we should expect input:arg1 to take? in this case, there are ways for us to determine the root folder that the user test fetches the default value from. But I don't see it be properly managed in this change. |
When an active root folder can be determined (open editor, basically) the context for variable evaluation becomes that root folder. When no root folder can be determined (do a file->open of a file outside any workspace root), the first workspace folder is used. |
If we don't want to follow the VS code behavior maybe i missed something If we do want to follow what VS code does |
@elaihau I'm really having trouble with your animated gifs: they proceed really fast and I can't install a plugin to stop them on Firefox. |
"Steps to reproduce" are much appreciated, unless it's something visual. |
sure here they are
In my env, the user task uses |
Let me check your case: it's supposed to work, don't know why not. VS Code does not seem to inherit any inputs from the user level: it refuses to run a folder-level task unless the input var is defined in the same folder. I suspect making this the same as VS code would be hard, since we'd have to special-case it, like the task configurations, I suspect. |
@tsmaeder Is it important right now for your use case? |
Seems the "context key" always decides that the "resource" is the first workspace folder. That seems to happen inside monaco. 🤷 |
Actually, "it's me honey, not you"....I'm setting the resolution context to the wrong place :-( |
ebb3cb7
to
3fcd68b
Compare
@elaihau your case should be addressed in the latest commit. |
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 again. Looks really good to me. Thank you for the work !
Signed-off-by: Thomas Mäder <[email protected]>
3fcd68b
to
415d602
Compare
Looks good. Looked through the code again and smoked test debugging from different launch configurations. |
I've squashed the commits and would merge later today. |
Signed-off-by: Thomas Mäder [email protected]
Fixes: #7446 (Support User Level Tasks)
What it does
This PR adds support for adding tasks in ~/.theia/tasks.json. It does so by extending the support for preference configurations to user-level preferences and accessing that preference scope directly for reading tasks. That code has been refactored a bit to enable this.
Contributed tasks can not be configured as user-level tasks, and only shell and terminal task types work as user-level tasks (same as in VS Code.
A command to "Tasks: Open User Tasks" has been added that opens an editor on the user-level tasks.json
How to test
Known problems
Review checklist
Reminder for reviewers