Skip to content

Commit

Permalink
Added doc comments
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Mäder <[email protected]>
  • Loading branch information
tsmaeder committed Feb 8, 2021
1 parent 02e1151 commit 0de7cbd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/********************************************************************************
* Copyright (C) 2020 Red Hat, Inc.
*
Expand All @@ -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 {
Expand Down
12 changes: 10 additions & 2 deletions packages/plugin-ext/src/hosted/node/scanners/plugin-uri-factory.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/********************************************************************************
* Copyright (C) 2020 Red Hat, Inc.
*
Expand All @@ -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;
}

0 comments on commit 0de7cbd

Please sign in to comment.