Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to run dart and flutter vscode extensions #6044

Merged
merged 10 commits into from
Sep 4, 2019
Prev Previous commit
Next Next commit
[plugin] implement Plugin.isActive check
before it was stub with `true` always

Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
  • Loading branch information
akosyakov committed Sep 4, 2019
commit b71fad24c74261a94a293bdade95e957991fdaff
1 change: 1 addition & 0 deletions packages/plugin-ext/src/common/plugin-api-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export interface PluginManager {
getPluginById(pluginId: string): Plugin | undefined;
getPluginExport(pluginId: string): PluginAPI | undefined;
isRunning(pluginId: string): boolean;
isActive(pluginId: string): boolean;
activatePlugin(pluginId: string): PromiseLike<void>;
onDidChange: theia.Event<void>;
}
Expand Down
6 changes: 4 additions & 2 deletions packages/plugin-ext/src/plugin/plugin-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -831,18 +831,20 @@ export function createAPIFactory(
class Plugin<T> implements theia.Plugin<T> {
id: string;
pluginPath: string;
isActive: boolean;
// tslint:disable-next-line:no-any
packageJSON: any;
pluginType: theia.PluginType;
constructor(private readonly pluginManager: PluginManager, plugin: InternalPlugin) {
this.id = plugin.model.id;
this.pluginPath = plugin.pluginFolder;
this.packageJSON = plugin.rawModel;
this.isActive = true;
this.pluginType = plugin.model.entryPoint.frontend ? 'frontend' : 'backend';
}

get isActive(): boolean {
return this.pluginManager.isActive(this.id);
}

get exports(): T {
return <T>this.pluginManager.getPluginExport(this.id);
}
Expand Down
4 changes: 4 additions & 0 deletions packages/plugin-ext/src/plugin/plugin-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
return this.registry.has(pluginId);
}

isActive(pluginId: string): boolean {
return this.activatedPlugins.has(pluginId);
}

activatePlugin(pluginId: string): PromiseLike<void> {
if (this.pluginActivationPromises.has(pluginId)) {
return this.pluginActivationPromises.get(pluginId)!.promise;
Expand Down