Adds configuration option for large file warning threshold.

This commit is contained in:
Nathaniel Ringo
2016-08-16 16:43:16 -05:00
parent f376316d60
commit b32b8b40fe
2 changed files with 5 additions and 1 deletions

View File

@@ -122,6 +122,10 @@ module.exports =
{value: 'no', description: 'Do not send any telemetry data'}
{value: 'undecided', description: 'Undecided (Atom will ask again next time it is launched)'}
]
warnOnLargeFileLimit:
description: 'Warn before opening files larger than this number of megabytes.'
type: 'number'
default: 20
editor:
type: 'object'
properties:

View File

@@ -550,7 +550,7 @@ class Workspace extends Model
fileSize = fs.getSizeSync(filePath)
largeFileMode = fileSize >= 2 * 1048576 # 2MB
if fileSize >= 20 * 1048576 # 20MB
if fileSize >= @config.get('core.warnOnLargeFileLimit') * 1048576 # 20MB by default
choice = @applicationDelegate.confirm
message: 'Atom will be unresponsive during the loading of very large files.'
detailedMessage: "Do you still want to load this file?"