updating wording for large file error

fixes #46748
This commit is contained in:
SteVen Batten 2018-03-27 16:54:19 -07:00
parent 2f8d4ea055
commit 5bf4195cc7
3 changed files with 5 additions and 7 deletions

View file

@ -175,14 +175,14 @@ export class TextFileEditor extends BaseTextEditor {
return TPromise.wrapError<void>(errors.create(toErrorMessage(error), {
actions: [
new Action('workbench.window.action.relaunchWithIncreasedMemoryLimit', nls.localize('relaunchWithIncreasedMemoryLimit', "Relaunch"), null, true, () => {
new Action('workbench.window.action.relaunchWithIncreasedMemoryLimit', nls.localize('relaunchWithIncreasedMemoryLimit', "Restart with {0} MB", memoryLimit), null, true, () => {
return this.windowsService.relaunch({
addArgs: [
`--max-memory=${memoryLimit}`
]
});
}),
new Action('workbench.window.action.configureMemoryLimit', nls.localize('configureMemoryLimit', 'Configure'), null, true, () => {
new Action('workbench.window.action.configureMemoryLimit', nls.localize('configureMemoryLimit', 'Configure Memory Limit'), null, true, () => {
return this.preferencesService.openGlobalSettings().then(editor => {
if (editor instanceof PreferencesEditor) {
editor.focusSearch('files.maxMemoryForLargeFilesMB');

View file

@ -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 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.")
'description': nls.localize('maxMemoryForLargeFilesMB', "Controls the memory available to VS Code after restart when trying to open large files. Same affect as specifying --max-memory=NEWSIZE on the command line.")
}
}
});

View file

@ -318,9 +318,8 @@ 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<number>(null, 'files.maxMemoryForLargeFilesMB') | 4096;
return onStatError(new FileOperationError(
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),
nls.localize('fileTooLargeForHeapError', "To open a file of this size, you need to restart VS Code and allow it to use more memory"),
FileOperationResult.FILE_EXCEED_MEMORY_LIMIT
));
}
@ -469,9 +468,8 @@ 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<number>(null, 'files.maxMemoryForLargeFilesMB') | 4096;
finish(new FileOperationError(
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),
nls.localize('fileTooLargeForHeapError', "To open a file of this size, you need to restart VS Code and allow it to use more memory"),
FileOperationResult.FILE_EXCEED_MEMORY_LIMIT
));
}