mirror of
https://github.com/moparisthebest/fernflower
synced 2024-11-29 20:42:22 -05:00
adjustable indentation
This commit is contained in:
parent
0a5a2c671e
commit
7189d18bfe
2
dist/docs/readme.txt
vendored
2
dist/docs/readme.txt
vendored
@ -67,7 +67,7 @@ urc : full name of user-supplied class implementing IIdentifierRenamer. It is
|
||||
inn (1): check for IntelliJ IDEA-specific @NotNull annotation and remove inserted code if found
|
||||
lac (0): decompile lambda expressions to anonymous classes
|
||||
nls (0): define new line character to be used for output. 0 - '\r\n' (Windows), 1 - '\n' (Linux)
|
||||
|
||||
ind : indentation string (default is " " (3 spaces))
|
||||
|
||||
The default logging level is INFO. This value can be overwritten by setting the option 'log' as follows:
|
||||
|
||||
|
@ -87,6 +87,7 @@ public class DecompilerContext {
|
||||
mapDefault.put(IFernflowerPreferences.REMOVE_EMPTY_RANGES, "1");
|
||||
|
||||
mapDefault.put(IFernflowerPreferences.NEW_LINE_SEPARATOR, "0");
|
||||
mapDefault.put(IFernflowerPreferences.INDENT_STRING, " ");
|
||||
|
||||
mapDefault.put(IFernflowerPreferences.IDEA_NOT_NULL_ANNOTATION, "1");
|
||||
|
||||
|
@ -50,6 +50,7 @@ public interface IFernflowerPreferences {
|
||||
public static final String NEW_LINE_SEPARATOR = "nls";
|
||||
public static final String IDEA_NOT_NULL_ANNOTATION = "inn";
|
||||
public static final String LAMBDA_TO_ANONYMOUS_CLASS = "lac";
|
||||
public static final String INDENT_STRING = "ind";
|
||||
|
||||
public static final String LINE_SEPARATOR_WIN = "\r\n";
|
||||
public static final String LINE_SEPARATOR_LIN = "\n";
|
||||
|
@ -25,9 +25,10 @@ import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
public class InterpreterUtil {
|
||||
import de.fernflower.main.DecompilerContext;
|
||||
import de.fernflower.main.extern.IFernflowerPreferences;
|
||||
|
||||
public static final String INDENT_STRING = " ";
|
||||
public class InterpreterUtil {
|
||||
|
||||
public static void copyFile(File in, File out) throws IOException {
|
||||
FileChannel inChannel = new FileInputStream(in).getChannel();
|
||||
@ -65,9 +66,10 @@ public class InterpreterUtil {
|
||||
}
|
||||
|
||||
public static String getIndentString(int length) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
String indent = (String) DecompilerContext.getProperty(IFernflowerPreferences.INDENT_STRING);
|
||||
StringBuilder buf = new StringBuilder();
|
||||
while(length-->0) {
|
||||
buf.append(INDENT_STRING);
|
||||
buf.append(indent);
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user