Config Key: break_chained_methods
Description: Break chained method calls across subsequent lines
Available since version: 0.7.0 (Current: )
Type: boolean
Default: false
Support
Languages: C#, EJS, JSX, Java, JavaScript, Riot, Swig, Twig, TypeScript
Beautifiers: JS-Beautify, Pretty Diff, ESLint
Comparison Table
Examples
Invisible characters are shown with the following symbols:
Carriage Return = ␍; Line Feed = ␊; Tab = ⇥; Whitespace = ·.
🚧 Original Code
using·System;␊
␊
class·Program␊
{␊
static·void·Main()␊
{␊
ui().s2p().mm().supplinvoice().manage().util().Constants().blabla();␊
}␊
}␊
🔧 true
Using Pretty Diff beautifier:
using·System;␊
␊
class·Program·{␊
··static·void·Main()·{␊
····ui()␊
······.s2p()␊
······.mm()␊
······.supplinvoice()␊
······.manage()␊
······.util()␊
······.Constants()␊
······.blabla();␊
··}␊
}␊
How to configure
A .unibeautify.json
file would look like the following:
{
"C#": {
"indent_size": 2,
"indent_char": " ",
"break_chained_methods": true,
"beautifiers": [
"Pretty Diff"
]
}
}
Difference from original
@@ -1,9 +1,14 @@
using·System;␊
␊
-class·Program␊
-{␊
-static·void·Main()␊
-{␊
-ui().s2p().mm().supplinvoice().manage().util().Constants().blabla();␊
+class·Program·{␊
+··static·void·Main()·{␊
+····ui()␊
+······.s2p()␊
+······.mm()␊
+······.supplinvoice()␊
+······.manage()␊
+······.util()␊
+······.Constants()␊
+······.blabla();␊
+··}␊
}␊
-}␊
🔧 false
Using Pretty Diff beautifier:
using·System;␊
␊
class·Program·{␊
··static·void·Main()·{␊
····ui().s2p().mm().supplinvoice().manage().util().Constants().blabla();␊
··}␊
}␊
How to configure
A .unibeautify.json
file would look like the following:
{
"C#": {
"indent_size": 2,
"indent_char": " ",
"break_chained_methods": false,
"beautifiers": [
"Pretty Diff"
]
}
}
Difference from original
@@ -1,9 +1,7 @@
using·System;␊
␊
-class·Program␊
-{␊
-static·void·Main()␊
-{␊
-ui().s2p().mm().supplinvoice().manage().util().Constants().blabla();␊
+class·Program·{␊
+··static·void·Main()·{␊
+····ui().s2p().mm().supplinvoice().manage().util().Constants().blabla();␊
+··}␊
}␊
-}␊
No example found. Please submit a Pull Request!
🚧 Original Code
foo.bar().baz();␊
␊
this.$("#fileName").val().addClass("disabled")␊
····.prop("disabled",·true)␊
␊
function·doStuff()·{␊
if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
return·false;␊
}␊
}␊
🔧 true
Using JS-Beautify beautifier:
foo.bar()␊
··.baz();␊
␊
this.$("#fileName")␊
··.val()␊
··.addClass("disabled")␊
··.prop("disabled",·true)␊
␊
function·doStuff()·{␊
··if·(oParameters.State·!==·ui()␊
····.s2p()␊
····.mm()␊
····.supplinvoice()␊
····.manage()␊
····.util()␊
····.Constants()␊
····.blabla())·{␊
····return·false;␊
··}␊
}
How to configure
A .unibeautify.json
file would look like the following:
{
"JSX": {
"indent_size": 2,
"indent_char": " ",
"break_chained_methods": true,
"beautifiers": [
"JS-Beautify"
]
}
}
Difference from original
@@ -1,10 +1,20 @@
-foo.bar().baz();␊
+foo.bar()␊
+··.baz();␊
␊
-this.$("#fileName").val().addClass("disabled")␊
-····.prop("disabled",·true)␊
+this.$("#fileName")␊
+··.val()␊
+··.addClass("disabled")␊
+··.prop("disabled",·true)␊
␊
function·doStuff()·{␊
-if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
-return·false;␊
-}␊
-}␊
+··if·(oParameters.State·!==·ui()␊
+····.s2p()␊
+····.mm()␊
+····.supplinvoice()␊
+····.manage()␊
+····.util()␊
+····.Constants()␊
+····.blabla())·{␊
+····return·false;␊
+··}␊
+}
\ No newline at end of file
🔧 false
Using JS-Beautify beautifier:
foo.bar().baz();␊
␊
this.$("#fileName").val().addClass("disabled")␊
··.prop("disabled",·true)␊
␊
function·doStuff()·{␊
··if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
····return·false;␊
··}␊
}
How to configure
A .unibeautify.json
file would look like the following:
{
"JSX": {
"indent_size": 2,
"indent_char": " ",
"break_chained_methods": false,
"beautifiers": [
"JS-Beautify"
]
}
}
Difference from original
@@ -1,10 +1,10 @@
foo.bar().baz();␊
␊
this.$("#fileName").val().addClass("disabled")␊
-····.prop("disabled",·true)␊
+··.prop("disabled",·true)␊
␊
function·doStuff()·{␊
-if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
-return·false;␊
-}␊
-}␊
+··if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
+····return·false;␊
+··}␊
+}
\ No newline at end of file
🚧 Original Code
public·class·HelloWorld·{␊
␊
····public·static·void·main(String[]·args)·{␊
········
········System.out.println("Hello,·World");␊
␊
········This.is.a.really.really.very.extremely.terrible.unbearably.long.method.chain("Hello,·World");␊
␊
····}␊
␊
}␊
🔧 true
Using Pretty Diff beautifier:
public·class·HelloWorld·{␊
␊
··public·static·void·main(String[]·args)·{␊
····//·Prints·"Hello,·World"·to·the·terminal·window.␊
····System␊
······.out␊
······.println("Hello,·World");␊
␊
····This␊
······.is␊
······.a␊
······.really␊
······.really␊
······.very␊
······.extremely␊
······.terrible␊
······.unbearably␊
······.long␊
······.method␊
······.chain("Hello,·World");␊
␊
··}␊
␊
}␊
How to configure
A .unibeautify.json
file would look like the following:
{
"Java": {
"indent_size": 2,
"indent_char": " ",
"break_chained_methods": true,
"beautifiers": [
"Pretty Diff"
]
}
}
Difference from original
@@ -1,11 +1,24 @@
public·class·HelloWorld·{␊
␊
-····public·static·void·main(String[]·args)·{␊
-········//·Prints·"Hello,·World"·to·the·terminal·window.␊
-········System.out.println("Hello,·World");␊
+··public·static·void·main(String[]·args)·{␊
+····//·Prints·"Hello,·World"·to·the·terminal·window.␊
+····System␊
+······.out␊
+······.println("Hello,·World");␊
␊
-········This.is.a.really.really.very.extremely.terrible.unbearably.long.method.chain("Hello,·World");␊
+····This␊
+······.is␊
+······.a␊
+······.really␊
+······.really␊
+······.very␊
+······.extremely␊
+······.terrible␊
+······.unbearably␊
+······.long␊
+······.method␊
+······.chain("Hello,·World");␊
␊
-····}␊
+··}␊
␊
}␊
🔧 false
Using Pretty Diff beautifier:
public·class·HelloWorld·{␊
␊
··public·static·void·main(String[]·args)·{␊
····
····System.out.println("Hello,·World");␊
␊
····This.is.a.really.really.very.extremely.terrible.unbearably.long.method.chain("Hello,·World");␊
␊
··}␊
␊
}␊
How to configure
A .unibeautify.json
file would look like the following:
{
"Java": {
"indent_size": 2,
"indent_char": " ",
"break_chained_methods": false,
"beautifiers": [
"Pretty Diff"
]
}
}
Difference from original
@@ -1,11 +1,11 @@
public·class·HelloWorld·{␊
␊
-····public·static·void·main(String[]·args)·{␊
-········//·Prints·"Hello,·World"·to·the·terminal·window.␊
-········System.out.println("Hello,·World");␊
+··public·static·void·main(String[]·args)·{␊
+····//·Prints·"Hello,·World"·to·the·terminal·window.␊
+····System.out.println("Hello,·World");␊
␊
-········This.is.a.really.really.very.extremely.terrible.unbearably.long.method.chain("Hello,·World");␊
+····This.is.a.really.really.very.extremely.terrible.unbearably.long.method.chain("Hello,·World");␊
␊
-····}␊
+··}␊
␊
}␊
🚧 Original Code
foo.bar().baz();␊
␊
this.$("#fileName").val().addClass("disabled")␊
····.prop("disabled",·true)␊
␊
function·doStuff()·{␊
if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
return·false;␊
}␊
}␊
🔧 true
Using JS-Beautify beautifier:
foo.bar()␊
··.baz();␊
␊
this.$("#fileName")␊
··.val()␊
··.addClass("disabled")␊
··.prop("disabled",·true)␊
␊
function·doStuff()·{␊
··if·(oParameters.State·!==·ui()␊
····.s2p()␊
····.mm()␊
····.supplinvoice()␊
····.manage()␊
····.util()␊
····.Constants()␊
····.blabla())·{␊
····return·false;␊
··}␊
}
How to configure
A .unibeautify.json
file would look like the following:
{
"JavaScript": {
"indent_size": 2,
"indent_char": " ",
"break_chained_methods": true,
"beautifiers": [
"JS-Beautify"
]
}
}
Difference from original
@@ -1,10 +1,20 @@
-foo.bar().baz();␊
+foo.bar()␊
+··.baz();␊
␊
-this.$("#fileName").val().addClass("disabled")␊
-····.prop("disabled",·true)␊
+this.$("#fileName")␊
+··.val()␊
+··.addClass("disabled")␊
+··.prop("disabled",·true)␊
␊
function·doStuff()·{␊
-if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
-return·false;␊
-}␊
-}␊
+··if·(oParameters.State·!==·ui()␊
+····.s2p()␊
+····.mm()␊
+····.supplinvoice()␊
+····.manage()␊
+····.util()␊
+····.Constants()␊
+····.blabla())·{␊
+····return·false;␊
+··}␊
+}
\ No newline at end of file
🔧 false
Using JS-Beautify beautifier:
foo.bar().baz();␊
␊
this.$("#fileName").val().addClass("disabled")␊
··.prop("disabled",·true)␊
␊
function·doStuff()·{␊
··if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
····return·false;␊
··}␊
}
How to configure
A .unibeautify.json
file would look like the following:
{
"JavaScript": {
"indent_size": 2,
"indent_char": " ",
"break_chained_methods": false,
"beautifiers": [
"JS-Beautify"
]
}
}
Difference from original
@@ -1,10 +1,10 @@
foo.bar().baz();␊
␊
this.$("#fileName").val().addClass("disabled")␊
-····.prop("disabled",·true)␊
+··.prop("disabled",·true)␊
␊
function·doStuff()·{␊
-if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
-return·false;␊
-}␊
-}␊
+··if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
+····return·false;␊
+··}␊
+}
\ No newline at end of file
No example found. Please submit a Pull Request!
No example found. Please submit a Pull Request!
No example found. Please submit a Pull Request!
🚧 Original Code
foo.bar().baz();␊
␊
this.$("#fileName").val().addClass("disabled")␊
····.prop("disabled",·true)␊
␊
function·doStuff()·{␊
if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
return·false;␊
}␊
}␊
🔧 true
Using Pretty Diff beautifier:
foo␊
··.bar()␊
··.baz();␊
␊
this␊
··.$("#fileName")␊
··.val()␊
··.addClass("disabled")␊
··.prop("disabled",·true)␊
␊
function·doStuff()·{␊
··if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
····return·false;␊
··}␊
}␊
How to configure
A .unibeautify.json
file would look like the following:
{
"TypeScript": {
"indent_size": 2,
"indent_char": " ",
"break_chained_methods": true,
"beautifiers": [
"Pretty Diff"
]
}
}
Difference from original
@@ -1,10 +1,15 @@
-foo.bar().baz();␊
+foo␊
+··.bar()␊
+··.baz();␊
␊
-this.$("#fileName").val().addClass("disabled")␊
-····.prop("disabled",·true)␊
+this␊
+··.$("#fileName")␊
+··.val()␊
+··.addClass("disabled")␊
+··.prop("disabled",·true)␊
␊
function·doStuff()·{␊
-if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
-return·false;␊
+··if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
+····return·false;␊
+··}␊
}␊
-}␊
🔧 false
Using Pretty Diff beautifier:
foo.bar().baz();␊
␊
this.$("#fileName").val().addClass("disabled").prop("disabled",·true)␊
␊
function·doStuff()·{␊
··if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
····return·false;␊
··}␊
}␊
How to configure
A .unibeautify.json
file would look like the following:
{
"TypeScript": {
"indent_size": 2,
"indent_char": " ",
"break_chained_methods": false,
"beautifiers": [
"Pretty Diff"
]
}
}
Difference from original
@@ -1,10 +1,9 @@
foo.bar().baz();␊
␊
-this.$("#fileName").val().addClass("disabled")␊
-····.prop("disabled",·true)␊
+this.$("#fileName").val().addClass("disabled").prop("disabled",·true)␊
␊
function·doStuff()·{␊
-if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
-return·false;␊
+··if·(oParameters.State·!==·ui().s2p().mm().supplinvoice().manage().util().Constants().blabla())·{␊
+····return·false;␊
+··}␊
}␊
-}␊