11Scalariform
22=========== 
33
4+ .. image :: https://travis-ci.org/daniel-trinh/scalariform.png?branch=master 
5+    :target:  https://travis-ci.org/daniel-trinh/scalariform 
6+ 
47Scalariform is a code formatter for Scala. It's available as a
58library, a stand-alone command line tool, or via integrations with
69various editors and build tools (listed below).
@@ -14,6 +17,13 @@ Scalariform is licenced under `The MIT Licence`_.
1417.. _Scala Style Guide : http://davetron5000.github.com/scala-style/ 
1518.. _The MIT Licence : http://www.opensource.org/licenses/mit-license.php 
1619
20+ Integration with sbt
21+ -------------------- 
22+ 
23+ A version for sbt >= 0.13.x has been written by Peter Vlugter: https://github.com/daniel-trinh/sbt-scalariform
24+ 
25+ Please see https://github.com/sbt/sbt-scalariform for older versions of sbt.
26+ 
1727Integration with Eclipse
1828------------------------ 
1929
@@ -22,7 +32,7 @@ Scala IDE for Eclipse uses Scalariform for code formatting:
2232- Right click in the editor -> Source -> Format
2333- Press Ctrl-Shift-F
2434
25- If you select some lines, only those will be formatted.  
35+ If you select some lines, only those will be formatted.
2636
2737You can also configure formatting to be run as a save action (Window -> Preferences -> Java -> Editor -> Save Actions).
2838
@@ -31,7 +41,7 @@ To set preferences, go to Window -> Preferences -> Scala -> Formatter
3141Integration with Emacs/ENSIME
3242----------------------------- 
3343
34- "`ENSIME `_ uses the Scalariform library to format Scala sources. Type C-c C-v f to format the current buffer."  
44+ "`ENSIME `_ uses the Scalariform library to format Scala sources. Type C-c C-v f to format the current buffer."
3545
3646  http://aemon.com/file_dump/ensime_manual.html#tth_sEc4.8
3747
@@ -73,16 +83,6 @@ Usage::
7383    </executions> 
7484  </plugin> 
7585
76- Integration with sbt
77- -------------------- 
78- 
79- `sbt-scalariform `_, written by Olivier Michallat, provides an sbt plugin contributing formatting actions for sbt 0.7.x.
80- 
81- A version for sbt 0.10.x has been written by Peter Vlugter: https://github.com/typesafehub/sbt-scalariform
82- 
83- .. _sbt-scalariform : http://github.com/olim7t/sbt-scalariform 
84- 
85- 
8686Integration with TextMate
8787------------------------- 
8888
@@ -123,26 +123,72 @@ alignParameters
123123
124124Default: ``false ``
125125
126- Align class/function parameters in the same column. For example, if ``false ``, then::
126+ Align class/function parameters (modifiers and name, type, and defaults) in three columns.
127+ 
128+ For example, if ``false ``, then::
127129
128130  class Person(name: String, 
129-     age: Int, 
131+     age: Int = 24 , 
130132    birthdate: Date, 
131-     astrologicalSign: String, 
133+     astrologicalSign: String = "libra" , 
132134    shoeSize: Int, 
133135    favoriteColor: java.awt.Color) 
134136
135137If ``true ``, then::
136138
137-   class Person(name: String, 
138-                age: Int, 
139-                birthdate: Date, 
140-                astrologicalSign: String, 
141-                shoeSize: Int, 
142-                favoriteColor: java.awt.Color) 
139+   class Person(name:             String, 
140+                age:              Int            = 24, 
141+                birthdate:        Date, 
142+                astrologicalSign: String         = "libra", 
143+                shoeSize:         Int, 
144+                favoriteColor:    java.awt.Color) 
145+ 
146+ This will also place the "implicit" keyword in parameters on it's own line, whenever
147+ the parameter being formatted contains a newline::
148+ 
149+ For example, if ``false ``, then::
150+ 
151+   def formatBirthDate( 
152+     implicit birthdate: Date = Date("11/11/11"), 
153+     birthtime: Time): DateTime 
154+ 
155+ If ``true ``, then::
156+ 
157+   def formatBirthDate( 
158+     implicit 
159+     birthdate: Date = Date("11/11/11"), 
160+     birthtime: Time): DateTime 
143161
144162This option is disabled if ``indentWithTabs `` is ``true ``.
145163
164+ 
165+ alignArguments
166+ ~~~~~~~~~~~~~~ 
167+ 
168+ Default: ``false ``
169+ 
170+ Aligns mult-line arguments
171+ 
172+ For example, if ``false ``, then::
173+ 
174+   Cake(candles = 10, 
175+     frostingFlavor = Vanilla, 
176+     layerFlavor = Chocolate, 
177+     icecream = true 
178+   ) 
179+ 
180+ If ``true ``, then::
181+ 
182+   Cake( 
183+     candles        = 10, 
184+     frostingFlavor = Vanilla, 
185+     layerFlavor    = Chocolate, 
186+     icecream       = true 
187+   ) 
188+ 
189+ This option is disabled if ``indentWithTabs `` is ``true ``.
190+ 
191+ 
146192alignSingleLineCaseStatements
147193~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
148194
@@ -204,7 +250,7 @@ using `Compact Control Readability`_ style:
204250
205251  try {
206252    foo()
207-   }  
253+   }
208254  catch {
209255    case _ => bar()
210256  }
@@ -319,7 +365,7 @@ indentSpaces
319365
320366Default: ``2 ``
321367
322- The number of spaces to use for each level of indentation.  
368+ The number of spaces to use for each level of indentation.
323369
324370This option is ignored if ``indentWithTabs `` is ``true ``.
325371
@@ -330,7 +376,7 @@ Default: ``false``
330376
331377Use a tab for each level of indentation. When set to ``true ``, this
332378ignores any setting given for ``indentSpaces ``. In addition, for the
333- moment, ``alignSingleLineCaseStatements `` and ``alignParameters ``
379+ moment, ``alignSingleLineCaseStatements ``, `` alignArguments ``,  and ``alignParameters ``
334380options are not supported when indenting with tabs, and XML
335381indentation is handled differently.
336382
@@ -341,14 +387,14 @@ Default: ``false``
341387
342388If ``true ``, start a multi-line Scaladoc comment body on same line as the opening comment delimiter::
343389
344-   /** This method applies f to each   
390+   /** This method applies f to each 
345391   *  element of the given list. 
346392   */ 
347393
348394If ``false ``, start the comment body on a separate line below the opening delimiter::
349395
350-   /**   
351-    * This method applies f to each   
396+   /** 
397+    * This method applies f to each 
352398   * element of the given list. 
353399   */ 
354400
@@ -358,7 +404,7 @@ preserveDanglingCloseParenthesis
358404Default: ``false ``
359405
360406If ``true ``, it will keep a newline before a close parenthesis ')' in an
361- argument expression. For example::
407+ argument expression or parameter clause . For example::
362408
363409  val book = Book( 
364410    name = "Name", 
@@ -373,6 +419,21 @@ If ``false``, the parenthesis will be joined to the end of the argument list::
373419    author = "Author", 
374420    rating = 5) 
375421
422+ 
423+ Or with parameters, if ``true ``::
424+ 
425+   def findBooks( 
426+     author: Option[String] = None, 
427+     title: Option[String] = None 
428+   ): List[Book] 
429+ 
430+ If ``false ``::
431+ 
432+   def findBooks( 
433+     author: Option[String] = None, 
434+     title: Option[String] = None): List[Book] 
435+ 
436+ 
376437placeScaladocAsterisksBeneathSecondAsterisk
377438~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
378439
@@ -381,14 +442,14 @@ Default: ``false``
381442If ``true ``, Scaladoc asterisks will be placed beneath the second asterisk::
382443
383444  /** Wibble 
384-     * wobble   
445+     * wobble 
385446    */ 
386447  class A 
387448
388449Otherwise, if ``false ``, beneath the first asterisk::
389450
390451  /** Wibble 
391-    *  wobble   
452+    *  wobble 
392453   */ 
393454  class A 
394455
@@ -474,6 +535,18 @@ If ``false``,::
474535
475536  case elem@Multi(values@_*) => 
476537
538+ spacesAroundMultiImports
539+ ~~~~~~~~~~~~~~~~~~~~~~~~ 
540+ 
541+ Default: ``true ``
542+ 
543+ Whether or not to add spaces around mutli-imports. For example, If ``true ``, then::
544+ 
545+   import a.{ b, c, d } 
546+ 
547+ If ``false ``, then::
548+ 
549+   import a.{b,c,d} 
477550
478551Scala Style Guide
479552~~~~~~~~~~~~~~~~~ 
@@ -487,14 +560,14 @@ make uncompliant source more compliant.
487560============================                ========= ========= 
488561Preference                                  Value     Default?
489562============================                ========= ========= 
490- alignParameters                             ``false ``  
491- compactStringConcatenation                  ``false ``  
563+ alignParameters                             ``false ``
564+ compactStringConcatenation                  ``false ``
492565doubleIndentClassDeclaration                ``true ``    No
493- indentSpaces                                ``2 ``        
566+ indentSpaces                                ``2 ``
494567placeScaladocAsterisksBeneathSecondAsterisk ``true ``    No
495- preserveSpaceBeforeArguments                ``false ``  
496- rewriteArrowSymbols                         ``false ``  
497- spaceBeforeColon                            ``false ``  
568+ preserveSpaceBeforeArguments                ``false ``
569+ rewriteArrowSymbols                         ``false ``
570+ spaceBeforeColon                            ``false ``
498571spaceInsideBrackets                         ``false ``
499572spaceInsideParentheses                      ``false ``
500573============================                ========= ========= 
@@ -510,24 +583,24 @@ format: [ON|OFF]
510583Disables the formatter for selective portions of a source file::
511584
512585  // format: OFF    <-- this directive disables formatting from this point 
513-   class AsciiDSL {   
586+   class AsciiDSL { 
514587    n ¦- "1" -+ { n: Node => 
515-             n ¦- "i"    
516-             n ¦- "ii"    
517-             n ¦- "iii"    
518-             n ¦- "iv"    
588+             n ¦- "i" 
589+             n ¦- "ii" 
590+             n ¦- "iii" 
591+             n ¦- "iv" 
519592            n ¦- "v" 
520593    } 
521594    n ¦- "2" 
522595    n ¦- "3" -+ { n: Node => 
523-             n ¦- "i"    
596+             n ¦- "i" 
524597            n ¦- "ii" -+ { n: Node => 
525598                     n ¦- "a" 
526599                     n ¦- "b" 
527600                     n ¦- "c" 
528601            } 
529-             n ¦- "iii"    
530-             n ¦- "iv"    
602+             n ¦- "iii" 
603+             n ¦- "iv" 
531604            n ¦- "v" 
532605    } 
533606    // format: ON   <-- formatter resumes from this point 
0 commit comments