Skip to content

Commit

Permalink
8965-hosted-plugin-outfiles
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
danarad05 committed May 25, 2021
1 parent 960a521 commit 6262d8c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,12 @@ export class HostedPluginManagerClient {

async startDebugSessionManager(): Promise<void> {
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({
Expand Down
9 changes: 9 additions & 0 deletions packages/plugin-dev/src/browser/hosted-plugin-preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,22 @@ 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']
}
}
};

export interface HostedPluginConfiguration {
'hosted-plugin.watchMode': boolean;
'hosted-plugin.debugMode': string;
'hosted-plugin.launchOutFiles': string[];
}

export const HostedPluginPreferences = Symbol('HostedPluginPreferences');
Expand Down

0 comments on commit 6262d8c

Please sign in to comment.