From 6262d8cf6bd06d5fbe2129bf4f3009a6bd0ff046 Mon Sep 17 00:00:00 2001 From: Dan Arad Date: Wed, 10 Mar 2021 17:18:30 +0200 Subject: [PATCH] 8965-hosted-plugin-outfiles Hosted Plugin debug session contained entire directory of plugin instead of only the out directory containing it - which resulted in performance warning because it would load all files in that directory. Also, added to preferences ability to configure launch `outFiles`. Signed-off-by: Dan Arad --- .../src/browser/hosted-plugin-manager-client.ts | 6 ++++-- .../plugin-dev/src/browser/hosted-plugin-preferences.ts | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/plugin-dev/src/browser/hosted-plugin-manager-client.ts b/packages/plugin-dev/src/browser/hosted-plugin-manager-client.ts index af43366d63e38..5438f86eef013 100644 --- a/packages/plugin-dev/src/browser/hosted-plugin-manager-client.ts +++ b/packages/plugin-dev/src/browser/hosted-plugin-manager-client.ts @@ -181,10 +181,12 @@ export class HostedPluginManagerClient { async startDebugSessionManager(): Promise { let outFiles: string[] | undefined = undefined; - if (this.pluginLocation) { + if (this.pluginLocation && this.hostedPluginPreferences['hosted-plugin.launchOutFiles'].length > 0) { const fsPath = await this.fileService.fsPath(this.pluginLocation); if (fsPath) { - outFiles = [new Path(fsPath).join('**', '*.js').toString()]; + outFiles = this.hostedPluginPreferences['hosted-plugin.launchOutFiles'].map(outFile => + outFile.replace('${pluginPath}', new Path(fsPath).toString()) + ); } } await this.debugSessionManager.start({ diff --git a/packages/plugin-dev/src/browser/hosted-plugin-preferences.ts b/packages/plugin-dev/src/browser/hosted-plugin-preferences.ts index d7359288288d4..e4dd28efeeacd 100644 --- a/packages/plugin-dev/src/browser/hosted-plugin-preferences.ts +++ b/packages/plugin-dev/src/browser/hosted-plugin-preferences.ts @@ -30,6 +30,14 @@ export const HostedPluginConfigSchema: PreferenceSchema = { description: 'Using inspect or inspect-brk for Node.js debug', default: 'inspect', enum: ['inspect', 'inspect-brk'] + }, + 'hosted-plugin.launchOutFiles': { + type: 'array', + items: { + type: 'string' + }, + description: 'Array of glob patterns for locating generated JavaScript files (`${pluginPath}` will be replaced by plugin actual path).', + default: ['${pluginPath}/out/**/*.js'] } } }; @@ -37,6 +45,7 @@ export const HostedPluginConfigSchema: PreferenceSchema = { export interface HostedPluginConfiguration { 'hosted-plugin.watchMode': boolean; 'hosted-plugin.debugMode': string; + 'hosted-plugin.launchOutFiles': string[]; } export const HostedPluginPreferences = Symbol('HostedPluginPreferences');