nim-lang / nim-mode

An emacs major mode for the Nim programming language
137 stars 46 forks source link

Wrong indentation in object type without ref but with fields for export #213

Open ogdenwebb opened 5 years ago

ogdenwebb commented 5 years ago

Conforming Bugs

Expected behavior:

type
  Person = object
    name*: string
    age*: int
    another*: string

Actual behavior:

# after calling 'electric-and-indent' or 'indent-region' 
# (even with electric-indent-mode disabled)
type
  Person = object
    name*: string
        age*: int
        another*: string
larme commented 4 years ago

more investigations:

only when the first field is exported the behaviour is wrong so:

type
  Person* = object
    name: string
    age*: string
    anohter*: string

is ok while

type
  Person* = object
    name*: string
        age*: string
        anohter*: string

will misbehave.

Also there's a dirty fix by inserting a space between * and :

type
  Person* = object
    name* : string
    age*: string
    anohter: string