-
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
tasks configs as preferences #5013
Comments
I will try to take care about it. It is required to complete #3434 for input variables in tasks: https://code.visualstudio.com/docs/editor/variables-reference#_input-variables |
I will leave it out for now and open a follow-up issue. It is very involving and deserve a separate PR. |
@akosyakov could you please advise where to find a tutorial / document that describes how "tasks from a separate file" is supported in vs code? I am interested. Thank you ! |
@elaihau i don't think there is proper docs on it, we've learned by testing and analyzing VS Code repo. The heavy-lifting of mixing preferences from external file or from settings already done by a preference service. You only need to rewrite a task extension that it does not manage tasks.json file anymore, but use a preference service to read it, the same way how the debug extension was refactored. There is a notice here:
|
Bindings for launch in the debug extension: https://github.com/theia-ide/theia/blob/aff18c8f31661e18b22d05f71b56b4ed65975093/packages/debug/src/browser/preferences/launch-preferences.ts#L36-L40 How launch configuration are loaded in the debug extension: https://github.com/theia-ide/theia/blob/aff18c8f31661e18b22d05f71b56b4ed65975093/packages/debug/src/browser/debug-configuration-model.ts#L68 How changes to launch configurations are reconciled in the debug extension: https://github.com/theia-ide/theia/blob/aff18c8f31661e18b22d05f71b56b4ed65975093/packages/debug/src/browser/debug-configuration-model.ts#L39-L43 |
we had some discussions in the office. since it is a good amount of work to do all the refactoring, would it be possible to keep the task extension as is, and simply make some modifications to the preference service, so that we can use the preference service as a proxy to access the task config ? in this way, the task configs wouldn't be stored with prefs or launch configs, but would be accessible from the preferences (or configurations, depending on how you want to call it). @akosyakov |
@elaihau It could be error prone though since task extension and vscode extensions read the same state from different sources, not necessary consistent at any given moment of time. And not memory efficient since we have to keep the same data twice in memory. |
Also you have to implement supporting tasks from settings.json and merging them with tasks from tasks.json and properly handling loading them from .theia or .vscode again for the task extension. I think it is easier to delete code from the task extension reading from a file and rely for it on the preferences service which already does everything. |
earlier today I also noticed that 1, defining tasks in 2, in theory, vscode extensions can add task configs to the pool through the preference API. but given all the flexibilities of contributing to the tasks pool directly through the tasks API, what is the advantage of going with the implicit way (i.e., using preferences) ? could you please kindly share some insights in regards to how much we are going to gain from having this in Theia vesus the effort ? @akosyakov |
What about handling different settings folders? like reading from I don't think partial reimplementation of the preference logic in the task extension is the right direction. Otherwise whenever we will need to change the preference logic we will need to update the task extension or think whether it is worth of doing. I think the right direction is to hide this logic from the task extension in the preference service. It is correct even in corner cases, based on tested code (we have over 800 tests to make sure that preferences are merged in proper order from different folders and settings files) and with less memory consumption. I don't know whether there are users or VS Code extensions doing it, but i could not exclude that, like one can have shared tasks between workspaces if one defines them in user settings or a vs code extension can modify tasks.json to add such task. Also what is the effort? Register tasks as a preference contribution, replace watching with an event from |
@akosyakov
|
Not remove them, but change to use
no, if you aim for the minimal change with perseverance of APIs as much as possible and only updating implementations of |
- 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
- 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>
- 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>
- 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>
- 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 eclipse-theia#5013 Signed-off-by: Liang Huang <liang.huang@ericsson.com>
- 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>
- 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>
- 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 eclipse-theia#5013 Signed-off-by: Liang Huang <liang.huang@ericsson.com>
Task extension should not access tasks.json directly but use preference for it.
In VS Code tasks can be defined in a separate file as well as part of setting.json. #4947 allows to contribute such preferences and convert launch configs to them. It's a follow-up issue to do the same for tasks in order to provide VS Code compatibility.
cc @marcdumais-work @elaihau
The text was updated successfully, but these errors were encountered: