swift-emacs / swift-mode

Emacs support for Apple's Swift programming language.
GNU General Public License v3.0
372 stars 47 forks source link

Indention bug: enums #59

Closed ckruse closed 8 years ago

ckruse commented 10 years ago

Hi,

indention for enums is totally bugged:

enum OrderViewTableTakeAwayCells: Int {
  case DeliveryCell = 0,
                      nameCell = 1,
                                 emailCell = 2,
                                             phoneCell = 3,
                                                         couponCodeCell = 4,
                                                                          lastCellIndex
}
enum OrderViewTableDeliveryCells: Int {
  case DeliveryCell = 0,
                      nameCell,
                      emailCell,
                      phoneCell,
                      couponCodeCell,
                      addressCell,
                      address1Cell,
                      zipCell,
                      cityCell,
                      lastCellIndex
}
enum OtherEnum {
  case Val1
  case Val2
  case Val3
}
ap4y commented 9 years ago

Several related cases reported by @taku0 in #76:

enum Foo: Bar {
    case foo
    case bar
        var foo
}

enum Foo {
    case A(Int, [Int : String]), B, C
                                    func foo() {
    }
}
rumly111 commented 8 years ago

On my setup (emacs 24.4, swift-mode 0.4-cvs) indentation in enums is also broken, but it also causes emacs to "hang up"

enum Rank: Int {
    case Ace = 1
    case Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten
                                                          case Jack, Queen, King

When I press "enter" after "King", emacs starts computing something heavily, and it's impossible to use it anymore, only kill it.

nicklanasa commented 8 years ago

Been running into this more and more. Anybody have an idea what needs to be done to fix this?

taku0 commented 8 years ago

Closing in favor of the new indentation logic.