What is the best way to override/extend an extension?

I would like to customize behavior of the MiniBrowserOpenHandler class. There are only a few small changes I’d like to make, so I’d rather not have to fork the extension. Is there a way to leverage inversify to override the extension? I thought of using rebind(), but the class is bound to contributions that are also bound to many other implementations. Since rebind unbinds everything, this would not work (as far as I know, inversify doesn’t have a way to unbind specific classes).

If that’s not an option, is there a way to tell theia to skip the bindings for the extension altogether, so I can still extend the class but create my own bindings with my own implementation?

@bendavis if you need to perform any customizations, then you will need to need to create your own extension which extends/modifies the base behavior through dependency injection. It is never advised to fork an extension to perform modifications as it requires too much maintenance.

@vince-fugnitto I probably didn’t explain well. I am creating my own extension, but I’m not clear on how to override MiniBrowserOpenHandler using dependency injection.

For example, the following bindings are made in the mini-browser package:


I can’t figure out how to undo these bindings so that I can bind my MiniBrowserOpenHandlerOverride class to the same contributions, thus overriding the default behavior.

did you try rebind(MiniBrowserOpenHandler).to(MiniBrowserOpenHandlerOverride).inSingletonScope();

It reminds to my own problem I had a couple of weeks ago.

1 Like

@javahacks Thanks! That surprisingly seems to work. I didn’t realize rebind() would also take care of the other contribution bindings to the default class.

1 Like