Hello, Team,

I am try to remove “file: copy download link” command. when I rebind FileDownloadCommandContribution in my module:


I got following error:
Could not unbind serviceIdentifier: FileDownloadCommandContribution

Can anyone help?

@leogong99 thank you for the discussion, I just wanted to mention that it is possible to use the CommandRegistry.unregisterCommand API to unregister commands you do not want or require.

You cannot unbind a contribution, instead you can filter it out thanks to


import { bindContribution, FilterContribution } from '@theia/core/lib/common';
import { ContainerModule } from '@theia/core/shared/inversify';
import { TheiaNoDownloadFilterContribution } from './theia-no-download-contribution';

export default new ContainerModule(bind => {
    bindContribution(bind, TheiaNoDownloadFilterContribution, [FilterContribution]);


import { ContributionFilterRegistry, Filter, FilterContribution } from '@theia/core';
import { injectable } from '@theia/core/shared/inversify';
import { FileDownloadCommandContribution} from '@theia/filesystem/lib/browser/download/file-download-command-contribution';

export class TheiaNoDownloadFilterContribution implements FilterContribution {

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

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

Thanks @vince-fugnitto.

I have try above suggestion. it completed remove download feature. My goal is still keep download feature but remove copy_down_link option.

Any more suggestion?

Thank you very much.


@leogong99 if I understand correctly you want to keep the feature but remove the context-menu item only? If that’s the case you can unregister the menu (

If I did not understand the use-case please let me know! :slight_smile:

Thanks again @vince-fugnitto.
There is “copy download link” commands at here

I would like to remove this command.

Here is my code:

export class MYFileDownloadCommandContribution extends FileDownloadCommandContribution {
    registerCommands(commandRegistry: CommandRegistry): void {
        // Remove File -> copy download link.

// my module:

bind(MYFileDownloadCommandContribution).toSelf().inSingletonScope(); rebind(FileDownloadCommandContribution).to(MYFileDownloadCommandContribution).inSingletonScope();


Seems like FileDownloadCommandContribution was not initial load so rebind won’t find FileDownloadCommandContribution

Could not unbind serviceIdentifier: FileDownloadCommandContribution

@leogong99 as mentioned you cannot rebind a contribution, only filter it out. If you were to use the api to unregisterCommand it would look something like this:


import { inject, injectable } from '@theia/core/shared/inversify';
import { CommandRegistry } from '@theia/core';
import { FrontendApplicationContribution } from '@theia/core/lib/browser/frontend-application';
import { FileDownloadCommands } from '@theia/filesystem/lib/browser/download/file-download-command-contribution';

export class TheiaNoDownloadContribution implements FrontendApplicationContribution {

    protected readonly commandRegistry: CommandRegistry;

    async onStart(): Promise<void> {


import { FrontendApplicationContribution } from '@theia/core/lib/browser';
import { ContainerModule } from '@theia/core/shared/inversify';
import { TheiaNoDownloadContribution } from './theia-unregister-contribution';

export default new ContainerModule(bind => {

Thank you very much. Really appreciate your help.

1 Like