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

Provide API to filter unwanted contributions from frontend extensions #9069

Closed
tortmayr opened this issue Feb 15, 2021 · 2 comments · Fixed by #9317
Closed

Provide API to filter unwanted contributions from frontend extensions #9069

tortmayr opened this issue Feb 15, 2021 · 2 comments · Fixed by #9317
Labels
extensibility issues to simplify ability to extend Theia proposal feature proposals (potential future features)
Milestone

Comments

@tortmayr
Copy link
Contributor

When building custom tools or IDE’s with Theia that are heavily streamlined for a specific domain we might run into the issue that the custom solution only requires a subset of the functionality that is provided by existing core Theia extensions/plugins. This can be problematic when existing core extensions also provide frontend contributions that are not needed/unwanted. These contributions may clutter the UI so it should be possible to remove or at least hide them. The support of VSCode APIs also has a negative impact on this. The plugin system depends on many Theia extensions which means it is no longer possible to create minimal Theia applications because they will be pulled in indirectly again.(see also #7754).

The currently recommended workaround to hide unwanted contributions is to bind a stub implementation (see also #8293). The contribution will still get loaded at runtime but effectively does nothing. This is obviously not optimal and is not generally applicable. For instance, it is not possible to stub contributions that have been bound to a dynamic value. Typically core Theia extensions now provide a single contribution class implementing various contribution interfaces to support this stubbing approach. However, there are still some exceptions (e.g. some contributions in @theia/callhierachy are still dynamically bound) and for third-party extension no such assumption can be made. In addition, rebinding an external contribution to a no-op implementation could also have negative side effects on external extensions that use this contribution.

We propose an alternative approach by introducing a generic contribution filter API that enables the specification of filters to hide/display certain UI contributions (similar to the concept of activities used in Eclipse RCP). A filter has to specify the contribution types (i.e. service identifier) it’s intended for (e.g. MenuContribution) and a test() method that indicates whether a contribution should be filtered out. Filters should be configurable via DI and a central registry should be available. This central registry can then be queried by the ContainerBasedContributionProviders to retrieve the registered filters for a service identifier and filter the set of provided services accordingly.
This approach is less invasive and more flexible than rebinding an external contribution to a stub implementation.

We have a running PoC for this approach. In particular we implemented two base filter classes that operate on string level and can be used to filter contributions either based on their class name or by evaluating a specific property (e.g id of the contribution).

If you agree with the suggested solution and are interested in integrating this Filter API directly into Theia we would happily provide a PR based on our current PoC.

We (EclipseSource) intend to contribute to this on behalf of ST Microelectronics.

@vince-fugnitto vince-fugnitto added extensibility issues to simplify ability to extend Theia proposal feature proposals (potential future features) labels Feb 15, 2021
@thegecko
Copy link
Member

We implemented something similar to unregister contributions, which could be a good starting point:

#2951

@paul-marechal
Copy link
Member

paul-marechal commented Feb 19, 2021

I also wonder if there would be interest in trying to change the way contributions are made in the first place to maybe exhaustively declare all contributions and add a mechanism to whitelist/blacklist those? A bit like how VS Code extensions define every contribution in package.json. If we can filter things before runtime it would allow us to exclude unwanted contributions from the bundles with tree shaking, leading to faster downloads of the frontend hopefully? It would be a more breaking change than what seems to be proposed by @tortmayr, but I'd like to get feedback as I think a build time solution might be better.

@JonasHelming JonasHelming added this to the 1.13.0 milestone Mar 21, 2021
tortmayr added a commit to eclipsesource/theia that referenced this issue Mar 22, 2021
Fixes eclipse-theia#9069
Signed-off-by: Tobias Ortmayr tortmayr@eclipsesource.com
Contributed on behalf of STMicroelectronics
tortmayr added a commit to eclipsesource/theia that referenced this issue Mar 22, 2021
Fixes eclipse-theia#9069
Signed-off-by: Tobias Ortmayr tortmayr@eclipsesource.com
Contributed on behalf of STMicroelectronics
tortmayr added a commit to eclipsesource/theia that referenced this issue Mar 22, 2021
Fixes eclipse-theia#9069
Signed-off-by: Tobias Ortmayr tortmayr@eclipsesource.com
Contributed on behalf of STMicroelectronics
tortmayr added a commit to eclipsesource/theia that referenced this issue Apr 7, 2021
Fixes eclipse-theia#9069
Signed-off-by: Tobias Ortmayr tortmayr@eclipsesource.com
Contributed on behalf of STMicroelectronics
sdirix pushed a commit to eclipsesource/theia that referenced this issue Apr 8, 2021
Adds the ContributionFilterRegistry which can be used to filter
contributions of Theia extensions before they are bound.

This mechanism can be used by application developers to specifically
filter individual contributions from Theia extensions they have no
control over, i.e. core or 3rd party extensions.

Implements eclipse-theia#9069

Contributed on behalf of STMicroelectronics

Signed-off-by: Tobias Ortmayr tortmayr@eclipsesource.com
sdirix pushed a commit to eclipsesource/theia that referenced this issue Apr 8, 2021
Adds the ContributionFilterRegistry which can be used to filter
contributions of Theia extensions before they are bound.

This mechanism can be used by application developers to specifically
filter individual contributions from Theia extensions they have no
control over, i.e. core or 3rd party extensions.

Implements eclipse-theia#9069

Contributed on behalf of STMicroelectronics

Signed-off-by: Tobias Ortmayr <tortmayr@eclipsesource.com>
sdirix pushed a commit to eclipsesource/theia that referenced this issue Apr 8, 2021
Adds the ContributionFilterRegistry which can be used to filter
contributions of Theia extensions before they are bound.

This mechanism can be used by application developers to specifically
filter individual contributions from Theia extensions they have no
control over, i.e. core or 3rd party extensions.

Resolves eclipse-theia#9069

Contributed on behalf of STMicroelectronics

Signed-off-by: Tobias Ortmayr <tortmayr@eclipsesource.com>
tortmayr added a commit to eclipsesource/theia that referenced this issue Apr 8, 2021
Adds the ContributionFilterRegistry which can be used to filter
contributions of Theia extensions before they are bound.

This mechanism can be used by application developers to specifically
filter individual contributions from Theia extensions they have no
control over, i.e. core or 3rd party extensions.

Resolves eclipse-theia#9069

Contributed on behalf of STMicroelectronics

Signed-off-by: Tobias Ortmayr <tortmayr@eclipsesource.com>
tortmayr added a commit to eclipsesource/theia that referenced this issue Apr 8, 2021
Adds the ContributionFilterRegistry which can be used to filter
contributions of Theia extensions before they are bound.

This mechanism can be used by application developers to specifically
filter individual contributions from Theia extensions they have no
control over, i.e. core or 3rd party extensions.

Resolves eclipse-theia#9069

Contributed on behalf of STMicroelectronics

Signed-off-by: Tobias Ortmayr <tortmayr@eclipsesource.com>
tortmayr added a commit to eclipsesource/theia that referenced this issue Apr 8, 2021
Adds the ContributionFilterRegistry which can be used to filter
contributions of Theia extensions before they are bound.

This mechanism can be used by application developers to specifically
filter individual contributions from Theia extensions they have no
control over, i.e. core or 3rd party extensions.

Resolves eclipse-theia#9069

Contributed on behalf of STMicroelectronics

Signed-off-by: Tobias Ortmayr <tortmayr@eclipsesource.com>
tortmayr added a commit to eclipsesource/theia that referenced this issue Apr 9, 2021
Adds the ContributionFilterRegistry which can be used to filter
contributions of Theia extensions before they are bound.

This mechanism can be used by application developers to specifically
filter individual contributions from Theia extensions they have no
control over, i.e. core or 3rd party extensions.

Resolves eclipse-theia#9069

Contributed on behalf of STMicroelectronics

Signed-off-by: Tobias Ortmayr <tortmayr@eclipsesource.com>
Co-Authored-By: Paul Maréchal <paul.marechal@ericsson.com>
tortmayr added a commit to eclipsesource/theia that referenced this issue May 26, 2021
Adds the ContributionFilterRegistry which can be used to filter
contributions of Theia extensions before they are bound.

This mechanism can be used by application developers to specifically
filter individual contributions from Theia extensions they have no
control over, i.e. core or 3rd party extensions.

Resolves eclipse-theia#9069

Contributed on behalf of STMicroelectronics

Signed-off-by: Tobias Ortmayr <tortmayr@eclipsesource.com>
Co-Authored-By: Paul Maréchal <paul.marechal@ericsson.com>

squash me?

Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
tortmayr added a commit to eclipsesource/theia that referenced this issue Jun 9, 2021
Adds the ContributionFilterRegistry which can be used to filter
contributions of Theia extensions before they are bound.

This mechanism can be used by application developers to specifically
filter individual contributions from Theia extensions they have no
control over, i.e. core or 3rd party extensions.

Resolves eclipse-theia#9069

Contributed on behalf of STMicroelectronics

Signed-off-by: Tobias Ortmayr <tortmayr@eclipsesource.com>
Co-Authored-By: Paul Maréchal <paul.marechal@ericsson.com>

squash me?

Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
tortmayr added a commit to eclipsesource/theia that referenced this issue Jun 9, 2021
Adds the ContributionFilterRegistry which can be used to filter
contributions of Theia extensions before they are bound.

This mechanism can be used by application developers to specifically
filter individual contributions from Theia extensions they have no
control over, i.e. core or 3rd party extensions.

Resolves eclipse-theia#9069

Contributed on behalf of STMicroelectronics

Signed-off-by: Tobias Ortmayr <tortmayr@eclipsesource.com>
Co-Authored-By: Paul Maréchal <paul.marechal@ericsson.com>

squash me?

Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
@JonasHelming JonasHelming modified the milestones: 1.13.0, 1.15.0 Jun 9, 2021
tortmayr added a commit to eclipsesource/theia that referenced this issue Jun 9, 2021
Adds the ContributionFilterRegistry which can be used to filter
contributions of Theia extensions before they are bound.

This mechanism can be used by application developers to specifically
filter individual contributions from Theia extensions they have no
control over, i.e. core or 3rd party extensions.

Resolves eclipse-theia#9069

Contributed on behalf of STMicroelectronics

Signed-off-by: Tobias Ortmayr <tortmayr@eclipsesource.com>
Co-Authored-By: Paul Maréchal <paul.marechal@ericsson.com>

squash me?

Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
tortmayr added a commit to eclipsesource/theia that referenced this issue Jun 16, 2021
Adds the ContributionFilterRegistry which can be used to filter
contributions of Theia extensions before they are bound.

This mechanism can be used by application developers to specifically
filter individual contributions from Theia extensions they have no
control over, i.e. core or 3rd party extensions.

Resolves eclipse-theia#9069

Contributed on behalf of STMicroelectronics

Signed-off-by: Tobias Ortmayr <tortmayr@eclipsesource.com>
Co-Authored-By: Paul Maréchal <paul.marechal@ericsson.com>

squash me?

Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
paul-marechal pushed a commit that referenced this issue Jun 28, 2021
Adds the ContributionFilterRegistry which can be used to filter
contributions of Theia extensions before they are bound.

This mechanism can be used by application developers to specifically
filter individual contributions from Theia extensions they have no
control over, i.e. core or 3rd party extensions.

Resolves #9069

Contributed on behalf of STMicroelectronics

Signed-off-by: Tobias Ortmayr <tortmayr@eclipsesource.com>
Co-Authored-By: Paul Maréchal <paul.marechal@ericsson.com>

squash me?

Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
dna2github pushed a commit to dna2fork/theia that referenced this issue Aug 25, 2021
Adds the ContributionFilterRegistry which can be used to filter
contributions of Theia extensions before they are bound.

This mechanism can be used by application developers to specifically
filter individual contributions from Theia extensions they have no
control over, i.e. core or 3rd party extensions.

Resolves eclipse-theia#9069

Contributed on behalf of STMicroelectronics

Signed-off-by: Tobias Ortmayr <tortmayr@eclipsesource.com>
Co-Authored-By: Paul Maréchal <paul.marechal@ericsson.com>

squash me?

Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extensibility issues to simplify ability to extend Theia proposal feature proposals (potential future features)
Projects
None yet
5 participants