Skip to content

Commit

Permalink
Support evolution on proposed API extensionAny
Browse files Browse the repository at this point in the history
fixes #14115

contributed on behalf of STMicroelectronics

Signed-off-by: Remi Schnekenburger <[email protected]>
  • Loading branch information
rschnekenbu committed Sep 19, 2024
1 parent b8ecd13 commit f655917
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/plugin-ext/src/plugin/plugin-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ export function createAPIFactory(

const extensions: typeof theia.extensions = Object.freeze({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
getExtension<T = any>(extensionId: string, includeFromDifferentExtensionHosts: boolean = false): theia.Extension<T> | undefined {
getExtension<T = any>(extensionId: string, includeFromDifferentExtensionHosts: boolean = false): theia.Extension<T | undefined> | undefined {
includeFromDifferentExtensionHosts = false;
const plg = pluginManager.getPluginById(extensionId.toLowerCase());
if (plg) {
Expand Down
4 changes: 4 additions & 0 deletions packages/plugin/src/theia.proposed.extensionsAny.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ export module '@theia/plugin' {
* @param extensionId An extension identifier.
* @param includeDifferentExtensionHosts Include extensions from different extension host
* @return An extension or `undefined`.
*
* *Note* In Theia, includeDifferentExtensionHosts will always be set to false, as we only support one host currently.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function getExtension<T = any>(extensionId: string, includeDifferentExtensionHosts: boolean): Extension<T> | undefined;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function getExtension<T = any>(extensionId: string, includeDifferentExtensionHosts: true): Extension<T | undefined> | undefined;

/**
* All extensions across all extension hosts.
Expand Down

0 comments on commit f655917

Please sign in to comment.