Skip to content

Commit

Permalink
Fixing implict index error and extract duplicated code
Browse files Browse the repository at this point in the history
For #76442
  • Loading branch information
mjbvz committed Jul 9, 2019
1 parent f928d0e commit 0b31a16
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions src/vs/platform/issue/electron-main/issueService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,8 @@ export class IssueService implements IIssueService {
data
};

const environment = parseArgs(process.argv);
const config = objects.assign(environment, windowConfiguration);
for (let key in config) {
if (config[key] === undefined || config[key] === null || config[key] === '') {
delete config[key]; // only send over properties that have a true value
}
}

this._processExplorerWindow.loadURL(`${require.toUrl('vs/code/electron-browser/processExplorer/processExplorer.html')}?config=${encodeURIComponent(JSON.stringify(config))}`);
this._processExplorerWindow.loadURL(
toLauchUrl('vs/code/electron-browser/processExplorer/processExplorer.html', windowConfiguration));

this._processExplorerWindow.on('close', () => this._processExplorerWindow = null);

Expand Down Expand Up @@ -373,14 +366,19 @@ export class IssueService implements IIssueService {
features
};

const environment = parseArgs(process.argv);
const config = objects.assign(environment, windowConfiguration);
for (let key in config) {
if (config[key] === undefined || config[key] === null || config[key] === '') {
delete config[key]; // only send over properties that have a true value
}
return toLauchUrl('vs/code/electron-browser/issue/issueReporter.html', windowConfiguration);
}
}

function toLauchUrl<T>(pathToHtml: string, windowConfiguration: T): string {
const environment = parseArgs(process.argv);
const config = objects.assign(environment, windowConfiguration);
for (const keyValue of Object.keys(config)) {
const key = keyValue as keyof typeof config;
if (config[key] === undefined || config[key] === null || config[key] === '') {
delete config[key]; // only send over properties that have a true value
}

return `${require.toUrl('vs/code/electron-browser/issue/issueReporter.html')}?config=${encodeURIComponent(JSON.stringify(config))}`;
}
}

return `${require.toUrl(pathToHtml)}?config=${encodeURIComponent(JSON.stringify(config))}`;
}

0 comments on commit 0b31a16

Please sign in to comment.