How to use filterContribution?

Hello Theia Contributor.

I recently got into Theia and have been building blueprints and trying things out.

My question is, I’m trying to remove dependencies that are built in to theia blueprints using filterContribution.

However, they are still not being removed, hence my question.

Below is my current source code.

my frontend module source

import { bindFilterExtensionContribution } from ‘./filter-extension-contribution’;
import { ContainerModule } from ‘@theia/core/shared/inversify’;

export default new ContainerModule(bind => {

my contribution source

import { FilterContribution, ContributionFilterRegistry, bindContribution, Filter } from ‘@theia/core/lib/common’;
import { injectable, interfaces } from ‘@theia/core/shared/inversify’;

export class FilterExtensionContribution implements FilterContribution {

registerContributionFilters(registry: ContributionFilterRegistry): void {
    registry.addFilters('*', [
        filterClassName(name => name !== 'TerminalFrontendContribution')


export function bindFilterExtensionContribution(bind: interfaces.Bind): void {
bindContribution(bind, FilterExtensionContribution, [FilterContribution]);

function filterClassName(filter: Filter): Filter {
return object => {
const className = object?.constructor?.name;
return className
? filter(className)
: false;


you code looks correct to me. I have also quickly tested it in an example application and for me everything is filtered out as expected (The “Terminal” menu is gone, no longer possible to open the terminal widget etc.).

So I’m not sure why this is not working in your case. Did you add your extension as dependency to the browser/electron package.json?

Thank you for your interest.

I’m confused that it doesn’t seem to be working for me either.

I’m currently testing with electron, and the path is being tried by adding the extension to the dependencies in examples/electron/package.json.
One of the reasons I’m confused is that I’m sure the extension is applied, but the terminal hasn’t disappeared.
My reasoning for thinking the extension was applied is that electron’s src-gen/frontend/index.js contains the
in electron’s src-gen/frontend/index.js.

.then(function () { return import(‘filter-extension/lib/browser/filter-extension-frontend-module’).then(load) })

Yes you are right. Your extension is definitely applied.
I I understand you correctly the terminal widget is still visible? Could be a caching issue. Previously opened widgets are restored on application start. What about the "Teminal "menu in the top menu bar? If this is no longer visible your extension works as expected. Then you could just close the cached “terminal” widget.

My guess is that the script in electron’s package.json is currently incorrect…
But I can’t determine exactly where it’s wrong.

In what order should the build commands be entered after modifying the extension by blueprint?

I’m currently doing “yarn prepare → yarn electron start”.

i got found solve self

yarn browser rebuild && yarn electron rebuild
and yarn electron start

1 Like