diff --git a/src/vs/code/electron-main/window.ts b/src/vs/code/electron-main/window.ts index fbf636563ca9cffebe9ef4275e9ac1df8ddf351d..dbd4821bea1f9de5c11ca0d73f95ee9916193d89 100644 --- a/src/vs/code/electron-main/window.ts +++ b/src/vs/code/electron-main/window.ts @@ -560,7 +560,6 @@ export class CodeWindow implements ICodeWindow { if (cli) { configuration['disable-extensions'] = cli['disable-extensions']; - configuration['max-memory'] = cli['max-memory']; } configuration.isInitialStartup = false; // since this is a reload diff --git a/src/vs/workbench/parts/files/browser/editors/textFileEditor.ts b/src/vs/workbench/parts/files/browser/editors/textFileEditor.ts index c13d712d5391a7e5d686a794f6baa2df6c635925..05f2bfad02cab5d0c2f6eab70b72c1e1202e4585 100644 --- a/src/vs/workbench/parts/files/browser/editors/textFileEditor.ts +++ b/src/vs/workbench/parts/files/browser/editors/textFileEditor.ts @@ -30,7 +30,7 @@ import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/edi import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService'; import { ScrollType } from 'vs/editor/common/editorCommon'; -import { IWindowService } from 'vs/platform/windows/common/windows'; +import { IWindowsService } from 'vs/platform/windows/common/windows'; /** * An implementation of editor for file system resources. @@ -51,7 +51,7 @@ export class TextFileEditor extends BaseTextEditor { @IThemeService themeService: IThemeService, @IEditorGroupService editorGroupService: IEditorGroupService, @ITextFileService textFileService: ITextFileService, - @IWindowService private windowService: IWindowService, + @IWindowsService private windowsService: IWindowsService, @IPreferencesService private preferencesService: IPreferencesService ) { super(TextFileEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, textFileService, editorGroupService); @@ -171,12 +171,16 @@ export class TextFileEditor extends BaseTextEditor { } if ((error).fileOperationResult === FileOperationResult.FILE_EXCEED_MEMORY_LIMIT) { - let memoryLimit = this.configurationService.getValue(null, 'files.maxMemoryForLargeFilesMB'); + let memoryLimit = this.configurationService.getValue(null, 'files.maxMemoryForLargeFilesMB') | 4096; return TPromise.wrapError(errors.create(toErrorMessage(error), { actions: [ - new Action('workbench.window.action.reloadWithIncreasedMemoryLimit', nls.localize('reloadWithIncreasedMemoryLimit', "Reload"), null, true, () => { - return this.windowService.reloadWindow({ _: [], 'max-memory': memoryLimit }).then(() => true); + new Action('workbench.window.action.relaunchWithIncreasedMemoryLimit', nls.localize('relaunchWithIncreasedMemoryLimit', "Relaunch"), null, true, () => { + return this.windowsService.relaunch({ + addArgs: [ + `--max-memory=${memoryLimit}` + ] + }); }), new Action('workbench.window.action.configureMemoryLimit', nls.localize('configureMemoryLimit', 'Configure'), null, true, () => { return this.preferencesService.openGlobalSettings().then(editor => { diff --git a/src/vs/workbench/parts/files/electron-browser/files.contribution.ts b/src/vs/workbench/parts/files/electron-browser/files.contribution.ts index d6bf31f0576eb62d523f9de9470ac7c9cb0c1f82..69e208012e182e2f6eebf10f4adbb132e47d8862 100644 --- a/src/vs/workbench/parts/files/electron-browser/files.contribution.ts +++ b/src/vs/workbench/parts/files/electron-browser/files.contribution.ts @@ -286,7 +286,7 @@ configurationRegistry.registerConfiguration({ 'files.maxMemoryForLargeFilesMB': { 'type': 'number', 'default': 4096, - 'description': nls.localize('maxMemoryForLargeFilesMB', "The new limit on memory in MB to be used by the application when reloading to open large files. If you wish to start with a higher limit, you can launch the application from command line with --max-memory=NEWSIZE.") + 'description': nls.localize('maxMemoryForLargeFilesMB', "The new limit on memory in MB to be used by the application when relaunching to open large files. If you wish to start with a higher limit, you can launch the application from command line with --max-memory=NEWSIZE.") } } }); diff --git a/src/vs/workbench/services/files/node/fileService.ts b/src/vs/workbench/services/files/node/fileService.ts index 680c6f25fd9f86e046a076ef128237543abf5137..873c0914b1e784aecca508148b15598b8ee2964d 100644 --- a/src/vs/workbench/services/files/node/fileService.ts +++ b/src/vs/workbench/services/files/node/fileService.ts @@ -318,9 +318,9 @@ export class FileService implements IFileService { // Return early if file is too large to load if (typeof stat.size === 'number') { if (stat.size > Math.max(this.environmentService.args['max-memory'] * 1024 * 1024 || 0, MAX_HEAP_SIZE)) { - let memoryLimit = this.textResourceConfigurationService.getValue(null, 'files.maxMemoryForLargeFilesMB'); + let memoryLimit = this.textResourceConfigurationService.getValue(null, 'files.maxMemoryForLargeFilesMB') | 4096; return onStatError(new FileOperationError( - nls.localize('fileTooLargeForHeapError', "File size exceeds the default memory limit. Reload the window with a higher limit. The current setting is configured to reload with {0}MB", memoryLimit), + nls.localize('fileTooLargeForHeapError', "File size exceeds the default memory limit. Relaunch with a higher limit. The current setting is configured to relaunch with {0}MB", memoryLimit), FileOperationResult.FILE_EXCEED_MEMORY_LIMIT )); } @@ -469,9 +469,9 @@ export class FileService implements IFileService { } if (totalBytesRead > Math.max(this.environmentService.args['max-memory'] * 1024 * 1024 || 0, MAX_HEAP_SIZE)) { - let memoryLimit = this.textResourceConfigurationService.getValue(null, 'files.maxMemoryForLargeFilesMB'); + let memoryLimit = this.textResourceConfigurationService.getValue(null, 'files.maxMemoryForLargeFilesMB') | 4096; finish(new FileOperationError( - nls.localize('fileTooLargeForHeapError', "File size exceeds the default memory limit. Reload the window with a higher limit. The current setting is configured to reload with {0}MB", memoryLimit), + nls.localize('fileTooLargeForHeapError', "File size exceeds the default memory limit. Relaunch with a higher limit. The current setting is configured to relaunch with {0}MB", memoryLimit), FileOperationResult.FILE_EXCEED_MEMORY_LIMIT )); }