From 60f3999ae3cd69d749eabfae636dee19c9a18c17 Mon Sep 17 00:00:00 2001 From: Alexander Kass Date: Wed, 7 Dec 2016 13:50:23 +0300 Subject: [PATCH] Added option idea.max.content.load.filesize to open big files without intelligence IDEA-164785 --- bin/idea.properties | 5 +++++ .../src/com/intellij/openapi/util/io/FileUtilRt.java | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/bin/idea.properties b/bin/idea.properties index 56173097fee9..200f8a26e94c 100644 --- a/bin/idea.properties +++ b/bin/idea.properties @@ -30,6 +30,11 @@ #--------------------------------------------------------------------- idea.max.intellisense.filesize=2500 +#--------------------------------------------------------------------- +# Maximum file size (kilobytes) IDE is able to open. +#--------------------------------------------------------------------- +idea.max.content.load.filesize=20000 + #--------------------------------------------------------------------- # This option controls console cyclic buffer: keeps the console output size not higher than the specified buffer size (Kb). # Older lines are deleted. In order to disable cycle buffer use idea.cycle.buffer.size=disabled diff --git a/platform/util-rt/src/com/intellij/openapi/util/io/FileUtilRt.java b/platform/util-rt/src/com/intellij/openapi/util/io/FileUtilRt.java index 8f92fba40957..ad649b720c4a 100644 --- a/platform/util-rt/src/com/intellij/openapi/util/io/FileUtilRt.java +++ b/platform/util-rt/src/com/intellij/openapi/util/io/FileUtilRt.java @@ -44,7 +44,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; public class FileUtilRt { private static final int KILOBYTE = 1024; public static final int MEGABYTE = KILOBYTE * KILOBYTE; - public static final int LARGE_FOR_CONTENT_LOADING = Math.max(20 * MEGABYTE, getUserFileSizeLimit()); + public static final int LARGE_FOR_CONTENT_LOADING = Math.max(20 * MEGABYTE, Math.max(getUserFileSizeLimit(), getUserContentLoadLimit())); private static final int MAX_FILE_IO_ATTEMPTS = 10; private static final boolean USE_FILE_CHANNELS = "true".equalsIgnoreCase(System.getProperty("idea.fs.useChannels")); @@ -867,6 +867,15 @@ public class FileUtilRt { } } + public static int getUserContentLoadLimit() { + try { + return Integer.parseInt(System.getProperty("idea.max.content.load.filesize")) * KILOBYTE; + } + catch (NumberFormatException e) { + return 20 * MEGABYTE; + } + } + private interface CharComparingStrategy { CharComparingStrategy IDENTITY = new CharComparingStrategy() { public boolean charsEqual(char ch1, char ch2) {