[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/scala-mode 4e3a24f 043/217: Updated Examples.md to reflect
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/scala-mode 4e3a24f 043/217: Updated Examples.md to reflect issues already solved |
Date: |
Sun, 29 Aug 2021 11:30:40 -0400 (EDT) |
branch: elpa/scala-mode
commit 4e3a24f3763de9616ef9d5955c5feb8e1a029fc8
Author: Heikki Vesalainen <heikkivesalainen@yahoo.com>
Commit: Heikki Vesalainen <heikkivesalainen@yahoo.com>
Updated Examples.md to reflect issues already solved
---
Examples.md | 251 +++---------------------------------------------------------
1 file changed, 10 insertions(+), 241 deletions(-)
diff --git a/Examples.md b/Examples.md
index b4f801f..eb44f69 100644
--- a/Examples.md
+++ b/Examples.md
@@ -4,7 +4,7 @@ This file is for discussing indentation issues. If you have an
indentation that is broken, you can make a pull request for it to be
included here along with your view on how it should be indented.
-## parameter lists (value and type) ##
+## Indentation of constructor parameters and TemplateOpts (`extends`, `with`)
##
Scala style guide (example below) only recognizes two styles: either
all parameters are on one line, or then start the parameter list on a
@@ -21,208 +21,8 @@ class Foo(
extends Bar // note the single step (2 spaces)
```
-In scala-mode2, the indentation engine uses the first expression
-inside the parentheses as the indent anchor.
-
-```scala
-// current scala-mode2 with indent-value-expression
-
-val someLongName = aFunctionCall(
- one, // 1 or 2 steps varying on indent-value-expression
- two,
- tree)
-
-class Foo extends Map[
- String,
- Boolean](
- x: String, // as opposed to style guide we have only one step here
- y: Boolean) {
- body
-}
-
-def aFunction(
- one,
- two,
- tree) {
- body
-}
-
-val someLonName = for {
- i <- 1 to 10,
- j <- 2 to 4
- } yield i * j
-
-// style guide does not recorgnize this way of splitting the lines
-val someLongName = aFunctionCall( one,
- two, // aligned under one
- three )
-
-class Foo extends Map[String,
- Boolean]
-
-val someLonName = for { i <- 1 to 10,
- j <- 2 to 4 } yield i * j
-```
-
-
-### Proposal on what to change ###
-
-- parameter lists starting on a new line should follow the scala style
- guide, i.e. the list should be indented with double step (4 spaces)
- at least in the case of constructors.
-- flush-parameters-left mode that stops parameters aligning
-
-
-```scala
-// Proposed new indentation (flush-parameters-left has no effect)
-
-class Foo extends Map[
- String, // the style guide gives no guidance on how to indent these
- Boolean](
- x: String,
- y: Boolean) {
- body
-}
-
-def aFunction(
- one,
- two,
- tree) {
- body
-}
-```
-
-```scala
-// Proposed new indentation with flush-parameters-left == t
-
-def someLongName(foo: String,
- bar: String, zot: String) {
- body
-}
-
-val someLonName = for { i <- 1 to 10,
- j <- 2 to 4 // 1 or 2 steps varying on indent-value-expression
- } yield i * j
-```
-
-## Nested blocks and run-on lines in parameter lists ##
-
-Current indentation indents also the nested blocks and run-on
-lines acording to the same anchor as the parameter list itself.
-
-```scala
-// current scala-mode2 with indent-value-expression
-
-val someLongName = aFunctionCall(foo,
- aCollection map ( name =>
- value // a nested block
- ),
- "foo".
- length) // a run-on line
-
-val someLongName = aFunctionCall(aCollection map ( name =>
- value
- ))
-
-trait Foo extends Map[Option[x] forSome {
- type x <: String
- }, Boolean]
-
-val someLongName = aFunctionCall(
- foo, // 1 or 2 steps varying on indent-value-expression
- aCollection map ( name =>
- value
- ))
-
-val someLongName = aFunctionCall(
- aCollection map ( name =>
- value
- ))
-
-trait Foo extends Map[
- Option[x] forSome {
- type x <: String
- }, Boolean]
-
-
-```
-
-### Proposal on what to change ###
-
-- nothing, however if flush-parameters-left is implemented, then the
- nested block body is also flushed left
-
-```scala
-// indentation of nested blocks with proposed flush-parameters-left = t
-
-val someLongName = aFunctionCall(aCollection map ( name =>
- value // 1 or 2 steps varying on indent-value-expression
- ))
-
-val someLongName = aFunctionCall("foo".
- length
- )
-
-trait Foo extends Map[Option[x] forSome {
- type x <: String
- }, Boolean]
-```
-
-## Alignment of else and yield ##
-
-Currently `else` and `yield` are aligned below the `if` or `for` statement.
-
-```scala
-// current scala-mode2
-
-val x = if (foo)
- 1
- else
- 2
-
-val y = for (i <- 1 to 10)
- yield i * i
-
-val someLongName = aFunctionCall(bar,
- if (zot)
- 1
- else
- 3,
- for (i <- i to 10)
- yield i)
-
-val x = for {
- i <- i to 10 }
- yield i)
-
-```
-
-### Proposal on what to change ###
-
-I'm open to ideas! One proposal was to change the way `yield` is
-aligned under `for`
-
-```scala
-val y = for (i <- 1 to 10)
- yield i
-```
-
-With a variable similar to flush-parameters-left, `yield` and `else`
-(and `else if`) could also be
-
-```scala
-val y = for (i <- 1 to 10)
- yield i // one or two steps depending on indent-value-expression
-
-val y = if (zot)
- 1
- else
- 2
-```
-
-## Indentation of TemplateOpts (`extends`, `with`) ##
-
-Currently we do two step indent, which is against the style guide.
+Currently we do one step indent for params and two step indent, which
+is totally oposite to the style-guide.
```scala
// current scala-mode2
@@ -241,55 +41,24 @@ private abstract class Foo(
body
}
-private abstract class Foo(
- bar: String,
- zot: String
-) extends Bar
+// with scala-indent:align-parameters = t
+private abstract class Foo( bar: String,
+ zot: String )
+ extends Bar
with Zot {
body
}
+// with scala-indent:align-parameters = nil
private abstract class Foo( bar: String,
- zot: String )
+ zot: String )
extends Bar
with Zot {
body
}
-
-
```
### Proposal of what to change ###
-I'm hesitating. Should we change to what the style guide has, i.e. one step
indent
-
-```scala
-private abstract class Foo( bar: String, zot: String )
- extends Bar
- with Zot {
- body
-}
-
-private abstract class Foo(
- bar: String,
- zot: String)
- extends Bar
- with Zot {
- body
-}
+I'm hesitating. Should we change to what the style guide has?
-private abstract class Foo(
- bar: String,
- zot: String
-) extends Bar
- with Zot {
- body
-}
-
-private abstract class Foo( bar: String,
- zot: String )
- extends Bar
- with Zot {
- body
-}
-```
- [nongnu] elpa/scala-mode fe5c2c4 031/217: Fixes #11: was still using the slow regexp, not faster, (continued)
- [nongnu] elpa/scala-mode fe5c2c4 031/217: Fixes #11: was still using the slow regexp, not faster, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 1a3d958 029/217: forward/backward-sexp, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode e30b35a 008/217: Indentation working, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 59cdd94 074/217: Add `scala-indent:use-javadoc-style` defcustom., ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 347faeb 075/217: Add Evan Meagher to contributors list., ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 081a92b 081/217: scala-indent:remove-indent-from-previous-empty-line, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 0fac9ae 014/217: removed debug messages, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 9476d4c 018/217: Fixes #3: alignment of else inside parens, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 3f724ed 030/217: Add the scala-indent:pad-equals setting., ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 6257e3b 033/217: Renamed bad-equals to indent-value-expression. Added info to README.md, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 4e3a24f 043/217: Updated Examples.md to reflect issues already solved,
ELPA Syncer <=
- [nongnu] elpa/scala-mode 338ff73 060/217: Changed the indent defaults, closes #19, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 6c257f6 057/217: Enhanced support for comments and multi-line strings, including, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 68ca175 056/217: Fixes #20, the cons bug (a :: b :: Nil) as well as improving some of, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 78fff40 039/217: scala-indent:align-forms customization variable, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode f61e32d 047/217: Update README.md, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 0991658 051/217: Fixes #17: string syntax, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 3174f4c 048/217: Update README.md clone to be a valid command., ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode a78716d 046/217: Update README.md, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode ac13b94 061/217: post-self-insert-hooks, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 2201b1c 092/217: Interact nicely with global-font-lock-mode., ELPA Syncer, 2021/08/29