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

Make vscode/theia APIs contributed instead of built-in #8180

Closed

Conversation

tsmaeder
Copy link
Contributor

Signed-off-by: Thomas Mäder [email protected]

What it does

This a proof-of-concept PR for for issue Make "theia" and "vscode" contributed API's #8142

The idea is to not have any built-int API namespaces like 'theia' and 'vscode', but instead to only have a single mechanism for contributing API's. This PR is to show feasibility and to invite discussion. I have tested it as far as running the typescript-language-features built-in extension in a workspace containing the theia source. Plugins using the theia namespace and front-end plugins have not been tested so far.
The long-term idea would be to separate packages/plugin-ext into packages/plugin-ext and packages/plugin-ext-theia. Doing so should separate the mechanics of running plugins from the concrete API implementation. This will make the code base easier to understand and maintain.

How to test

This should not change anything in the behaviour of theia. Any front-end or back-end plugin should work just like before.

Review checklist

Reminder for reviewers

@tsmaeder tsmaeder requested review from benoitf and akosyakov July 16, 2020 08:21
@akosyakov akosyakov added the plug-in system issues related to the plug-in system label Jul 28, 2020

// eslint-disable-next-line @typescript-eslint/no-explicit-any
async computeInitParameters?(rpc: RPCProtocol, container: interfaces.Container): Promise<TheiaAPIInitParameters> {
const theiaMainPluginAPIProvider: TheiaMainPluginAPIProvider = container.get(TheiaMainPluginAPIProvider);
Copy link
Member

Choose a reason for hiding this comment

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

passing Container around is anti-pattern, one should use @inject

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that "initialize" does the same and unfortunately, using "@Inject" leads to errors at runtime. I have no idea why, though.

Copy link
Member

Choose a reason for hiding this comment

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

What's the error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some inversify error, but since this was > 1 year ago, I can't really remember precisely.

@akosyakov
Copy link
Member

Till VS Code extensions are working and there are not much over engineering to support one additional namespace is fine with me.

};
const mainProvider = mainApiProviders.get(api.id);
if (mainProvider && mainProvider.computeInitParameters) {
result.initParameters = await mainProvider.computeInitParameters(rpc, this.container);
Copy link
Member

Choose a reason for hiding this comment

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

we should check whether we disconnected after any async call and exit with undefined as it was before

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you mean like

if (toDisconnect.disposed) {
  return undefined;
}
`` 

@benoitf
Copy link
Contributor

benoitf commented Jul 28, 2020

Plugins using the theia namespace and front-end plugins have not been tested so far.

should be tested with theia namespace but also che namespace for my approval

overall is ok for me, just remove the che occurence from the code

The long-term idea would be to separate packages/plugin-ext into packages/plugin-ext and packages/plugin-ext-theia. Doing so should separate the mechanics of running plugins from the concrete API implementation. This will make the code base easier to understand and maintain.

I think long term is to have vscode API implemented in a single place and theia namespace being implemented only for stuff that does not fit within vscode namespace. Not sure if this PR helps.

@tsmaeder
Copy link
Contributor Author

tsmaeder commented Jul 28, 2020

should be tested with theia namespace but also che namespace for my approval

I agree for the theia namespace, but this PR should not change anything at all for the 'che' namespace. All namespaces being created equal is the point of this PR.

I think long term is to have vscode API implemented in a single place and theia namespace being implemented only for stuff that does not fit within vscode namespace. Not sure if this PR helps.

Currently we can only use either the theia or the vscode namespace, but not both for the same plugin. This PR enables using both namespaces in parallel. That is a prerequisite for removing the vscode duplication from the 'theia' namespace.

@tsmaeder
Copy link
Contributor Author

Till VS Code extensions are working and there are not much over engineering to support one additional namespace is fine with me.

Sorry, but I have no idea what you're trying to say here 🤷

@Artnoc1
Copy link

Artnoc1 commented Aug 3, 2020

Signed-off-by: Thomas Mäder [email protected]

What it does

This a proof-of-concept PR for for issue Make "theia" and "vscode" contributed API's #8142

The idea is to not have any built-int API namespaces like 'theia' and 'vscode', but instead to only have a single mechanism for contributing API's. This PR is to show feasibility and to invite discussion. I have tested it as far as running the typescript-language-features built-in extension in a workspace containing the theia source. Plugins using the theia namespace and front-end plugins have not been tested so far.
The long-term idea would be to separate packages/plugin-ext into packages/plugin-ext and packages/plugin-ext-theia. Doing so should separate the mechanics of running plugins from the concrete API implementation. This will make the code base easier to understand and maintain.

How to test

This should not change anything in the behaviour of theia. Any front-end or back-end plugin should work just like before.

Review checklist

* [ ]  as an author, I have thoroughly tested my changes and carefully followed [the review guidelines](https://github.com/theia-ide/theia/blob/master/doc/pull-requests.md#requesting-a-review)

Reminder for reviewers

* as a reviewer, I agree to behave in accordance with [the review guidelines](https://github.com/theia-ide/theia/blob/master/doc/pull-requests.md#reviewing)

@tsmaeder
Copy link
Contributor Author

tsmaeder commented Sep 8, 2021

@arekzaluski, @paul-marechal an feedback welcome.

@tsmaeder tsmaeder marked this pull request as ready for review September 8, 2021 08:06
@tsmaeder tsmaeder force-pushed the 8141_contribute_APIs_2 branch from 01e01f1 to 827430f Compare November 23, 2021 09:04
@JonasHelming JonasHelming added the decision_needed issues that require decisions on ways forward (ex: if they should be updated or closed) label Feb 9, 2022
@JonasHelming
Copy link
Contributor

@tsmaeder : Decision needed

@tsmaeder
Copy link
Contributor Author

tsmaeder commented Feb 9, 2022

I don't think anyone is going to merge this one any time soon. I've thought about it some more recently, and I think we'd have to solve a couple of problems with instantiating main/ext services if the vscode and theia namespaces become independent. Still a good idea, though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
decision_needed issues that require decisions on ways forward (ex: if they should be updated or closed) plug-in system issues related to the plug-in system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants