mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
parent
2f8d4ea055
commit
5bf4195cc7
|
@ -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');
|
||||
|
|
|
@ -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.")
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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
|
||||
));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue