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

[vscode] don't require non existing plugin main #7852

Merged
merged 1 commit into from
May 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/plugin-ext/src/common/plugin-api-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export interface PreferenceData {
}

export interface Plugin {
pluginPath: string;
pluginPath: string | undefined;
pluginFolder: string;
model: PluginModel;
rawModel: PluginPackage;
Expand Down
12 changes: 7 additions & 5 deletions packages/plugin-ext/src/hosted/browser/worker/worker-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ const webviewExt = new WebviewsExtImpl(rpc, workspaceExt);
const pluginManager = new PluginManagerExtImpl({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
loadPlugin(plugin: Plugin): any {
if (isElectron()) {
ctx.importScripts(plugin.pluginPath);
} else {
ctx.importScripts('/hostedPlugin/' + getPluginId(plugin.model) + '/' + plugin.pluginPath);
if (plugin.pluginPath) {
if (isElectron()) {
ctx.importScripts(plugin.pluginPath);
} else {
ctx.importScripts('/hostedPlugin/' + getPluginId(plugin.model) + '/' + plugin.pluginPath);
}
}

if (plugin.lifecycle.frontendModuleName) {
Expand Down Expand Up @@ -107,7 +109,7 @@ const pluginManager = new PluginManagerExtImpl({
pluginsModulesNames.set(plugin.lifecycle.frontendModuleName!, plugin);
} else {
foreign.push({
pluginPath: pluginModel.entryPoint.backend!,
pluginPath: pluginModel.entryPoint.backend,
pluginFolder: pluginModel.packagePath,
model: pluginModel,
lifecycle: pluginLifecycle,
Expand Down
7 changes: 5 additions & 2 deletions packages/plugin-ext/src/hosted/node/plugin-host-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ export class PluginHostRPC {
const { extensionTestsPath } = process.env;
const self = this;
const pluginManager = new PluginManagerExtImpl({
loadPlugin(plugin: Plugin): void {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
loadPlugin(plugin: Plugin): any {
console.log('PLUGIN_HOST(' + process.pid + '): PluginManagerExtImpl/loadPlugin(' + plugin.pluginPath + ')');
try {
// cleaning the cache for all files of that plug-in.
Expand Down Expand Up @@ -137,7 +138,9 @@ export class PluginHostRPC {
}

});
return require(plugin.pluginPath);
if (plugin.pluginPath) {
return require(plugin.pluginPath);
}
} catch (e) {
console.error(e);
}
Expand Down