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 #9317

Merged
merged 1 commit into from
Jun 28, 2021

Conversation

tortmayr
Copy link
Contributor

@tortmayr tortmayr commented Apr 8, 2021

What it does

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

How to test

  • You can take a look at the included test case, or
  • Contribute a ContributionFilter in an example Theia application

Review checklist

Reminder for reviewers

@tortmayr tortmayr force-pushed the filter-api branch 3 times, most recently from 13c96d0 to 4ae3ca5 Compare April 8, 2021 12:36
@sdirix sdirix mentioned this pull request Apr 8, 2021
1 task
@vince-fugnitto vince-fugnitto added core issues related to the core of the application extensibility issues to simplify ability to extend Theia labels Apr 8, 2021
Copy link
Member

@paul-marechal paul-marechal left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! Since this is going to be something core to Theia, I wanted to properly review it. Unfortunately I found enough things that bothered that I created a branch with most changes I'd be more comfortable with, see: eclipsesource/theia@filter-api...eclipse-theia:mp/filter-api-2

My issues mostly revolve around:

  1. Class hierarchies too deep for not much value. Take the following:

    @injectable()
    export class SampleFilteredCommandContributionFilter extends NameBasedContributionFilter {
        contributions = [CommandContribution];
        doTest(toTest: string): boolean {
            return equals(toTest, false, 'SampleFilteredCommandContribution');
        }
    }

    It takes 3 abstract classes just not to write:

            return equals(toTest.constructor.name, false, 'SampleFilteredCommandContribution');

    It also seems to me that filters won't really be extended in such a way that we'll need crazy extensibility. Correct me if I am wrong.

  2. Some of the logic can be rewritten more concisely.

  3. Some styling issues. It most likely means that our linting rules are not good enough?

If you agree with the changes I proposed on the mp/filter-api-2 branch, feel free to squash them into your commit, populating the Co-Authored-By: Paul ... line for IP stuff. The commit I made already contains fixes for most of what I reported in my review.

@tortmayr
Copy link
Contributor Author

tortmayr commented Apr 9, 2021

Thanks @marechal-p for your in-depth review and the proposed changes.I squashed your changes and added the Co-Authored-By: line to the commit message. I believe all mentioned issues should be resolved now.

Copy link
Contributor

@tsmaeder tsmaeder left a comment

Choose a reason for hiding this comment

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

This is a valuable contribution, but I think it would benefit from being done in a more functional style.

@tortmayr
Copy link
Contributor Author

@paul-marechal I have squashed your proposal for a more functional filtering approach and rebased the PR onto the latest master.

@marcdumais-work
Copy link
Contributor

@tortmayr just so you know, Paul is OOO this week, so it could take a few business days for a response, from him.

@tortmayr tortmayr force-pushed the filter-api branch 2 times, most recently from 28c0b14 to 6b65888 Compare June 9, 2021 07:28
@tortmayr
Copy link
Contributor Author

tortmayr commented Jun 9, 2021

Thanks for the re-review @paul-marechal. I removed the string-utils.ts file and rebased onto the current master

Copy link
Contributor

@tsmaeder tsmaeder left a comment

Choose a reason for hiding this comment

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

I like the general shape of this PR a lot now. I have a couple of questions I feel need answers though, hence a "Request changes".

@tsmaeder
Copy link
Contributor

@tortmayr @paul-marechal so how are we going to proceed here?

@paul-marechal
Copy link
Member

Waiting for @tortmayr to address the unaddressed comments?

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
Copy link
Contributor Author

tortmayr commented Jun 16, 2021

@paul-marechal I have rebased the PR and addressed the open comments.

@JonasHelming
Copy link
Contributor

@tsmaeder @paul-marechal : Are you good with this PR now?

Copy link
Contributor

@tsmaeder tsmaeder left a comment

Choose a reason for hiding this comment

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

Looks good to me now.

Copy link
Member

@paul-marechal paul-marechal left a comment

Choose a reason for hiding this comment

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

LGTM too, thanks!

@paul-marechal paul-marechal merged commit a28c440 into eclipse-theia:master Jun 28, 2021
@vince-fugnitto vince-fugnitto added this to the 1.15.0 milestone Jun 30, 2021
@sdirix sdirix deleted the filter-api branch May 16, 2024 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core issues related to the core of the application extensibility issues to simplify ability to extend Theia
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide API to filter unwanted contributions from frontend extensions
6 participants