Hi all,
I’m trying to replace SingleFileDownloadHandler
from here with my own implementaton:
packages/filesystem/src/node/download/file-download-handler.ts
in my extension’s package.json
, i added these:
{
"frontend": "lib/browser/download/file-download-frontend-module",
"backend": "lib/node/download/file-download-backend-module"
}
Added a file under my-extension/src/node/download/file-download-backend-module.ts
with the contents:
import { ContainerModule } from 'inversify';
import { FileDownloadHandler, SingleFileDownloadHandler } from '@theia/filesystem/lib/node/download/file-download-handler';
import { MyTestDownloadHandler } from './my-test-download-handler';
export default new ContainerModule((bind, unbind, isBound, rebind) => {
// My Custom Download handler
unbind(SingleFileDownloadHandler);
bind(SingleFileDownloadHandler).to(MyTestDownloadHandler).inSingletonScope().whenTargetNamed(FileDownloadHandler.SINGLE);
});
Build succeeded.
But, when I tried to run, I get the following error and the app terminates:
Failed to start the backend application.
Error: Could not unbind serviceIdentifier: SingleFileDownloadHandler
Also, if I remove the line unbind(SingleFileDownloadHandler);
then I get the following error when I run the app:
$ theia start --plugins=local-dir:../plugins/
Error: Ambiguous match found for serviceIdentifier: FileDownloadHandler
Can anyone help me how I can replace or override SingleFileDownloadHandler
?
Thank you very much in advance.