diff --git a/src/vs/code/electron-main/window.ts b/src/vs/code/electron-main/window.ts index 3ba6b432d86..baf4a0ab02a 100644 --- a/src/vs/code/electron-main/window.ts +++ b/src/vs/code/electron-main/window.ts @@ -118,6 +118,8 @@ export class CodeWindow extends Disposable implements ICodeWindow { private readonly touchBarGroups: TouchBarSegmentedControl[]; + private currentHttpProxy?: string; + constructor( config: IWindowCreationOptions, @ILogService private readonly logService: ILogService, @@ -594,6 +596,16 @@ export class CodeWindow extends Disposable implements ICodeWindow { this.currentMenuBarVisibility = newMenuBarVisibility; this.setMenuBarVisibility(newMenuBarVisibility); } + // Do not set to empty configuration at startup if setting is empty to not override configuration through CLI options: + const newHttpProxy = (this.configurationService.getValue('http.proxy') || '').trim() || undefined; + if (newHttpProxy !== this.currentHttpProxy) { + this.currentHttpProxy = newHttpProxy; + this._win.webContents.session.setProxy({ + proxyRules: newHttpProxy || '', + proxyBypassRules: '', + pacScript: '', + }); + } } addTabbedWindow(window: ICodeWindow): void {