diff --git a/packages/plugin-ext/src/hosted/node/scanners/file-plugin-uri-factory.ts b/packages/plugin-ext/src/hosted/node/scanners/file-plugin-uri-factory.ts index b262bf7c6e092..23ef9748c27ec 100644 --- a/packages/plugin-ext/src/hosted/node/scanners/file-plugin-uri-factory.ts +++ b/packages/plugin-ext/src/hosted/node/scanners/file-plugin-uri-factory.ts @@ -1,4 +1,3 @@ - /******************************************************************************** * Copyright (C) 2020 Red Hat, Inc. * @@ -21,7 +20,10 @@ import URI from '@theia/core/lib/common/uri'; import { FileUri } from '@theia/core/lib/node/file-uri'; import { PluginPackage } from '../../../common'; import { PluginUriFactory } from './plugin-uri-factory'; - +/** + * The default implementation of PluginUriFactory simply returns a File URI from the concatenated + * package path and relative path. + */ @injectable() export class FilePluginUriFactory implements PluginUriFactory { createUri(pkg: PluginPackage, pkgRelativePath?: string): URI { diff --git a/packages/plugin-ext/src/hosted/node/scanners/plugin-uri-factory.ts b/packages/plugin-ext/src/hosted/node/scanners/plugin-uri-factory.ts index 4223b2f23757d..9e41f42eb44af 100644 --- a/packages/plugin-ext/src/hosted/node/scanners/plugin-uri-factory.ts +++ b/packages/plugin-ext/src/hosted/node/scanners/plugin-uri-factory.ts @@ -1,4 +1,3 @@ - /******************************************************************************** * Copyright (C) 2020 Red Hat, Inc. * @@ -19,7 +18,16 @@ import URI from '@theia/core/lib/common/uri'; import { PluginPackage } from '../../../common'; export const PluginUriFactory = Symbol('PluginUriFactory'); - +/** + * Creates URIs for resources used in plugin contributions. Projects where plugin host is not located on the back-end + * machine and therefor resources cannot be loaded from the local file system in the back end can override the factory. + */ export interface PluginUriFactory { + /** + * Returns a URI that allows a file to be loaded given a plugin package and a path relative to the plugin's package path + * + * @param pkg the package this the file is contained in + * @param pkgRelativePath the path of the file relative to the package path, e.g. 'resources/snippets.json' + */ createUri(pkg: PluginPackage, pkgRelativePath?: string): URI; }