-
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
Make vscode/theia APIs contributed instead of built-in #8180
Conversation
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
async computeInitParameters?(rpc: RPCProtocol, container: interfaces.Container): Promise<TheiaAPIInitParameters> { | ||
const theiaMainPluginAPIProvider: TheiaMainPluginAPIProvider = container.get(TheiaMainPluginAPIProvider); |
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.
passing Container
around is anti-pattern, one should use @inject
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.
Note that "initialize" does the same and unfortunately, using "@Inject" leads to errors at runtime. I have no idea why, though.
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.
What's the error?
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.
Some inversify error, but since this was > 1 year ago, I can't really remember precisely.
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); |
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.
we should check whether we disconnected after any async call and exit with undefined as it was before
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.
you mean like
if (toDisconnect.disposed) {
return undefined;
}
``
should be tested with overall is ok for me, just remove the
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 |
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.
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. |
Sorry, but I have no idea what you're trying to say here 🤷 |
|
10deabf
to
01e01f1
Compare
@arekzaluski, @paul-marechal an feedback welcome. |
Signed-off-by: Thomas Mäder <tmader@redhat.com>
01e01f1
to
827430f
Compare
@tsmaeder : Decision needed |
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... |
Signed-off-by: Thomas Mäder tmader@redhat.com
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