nim-mode icon indicating copy to clipboard operation
nim-mode copied to clipboard

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

Open ogdenwebb opened this issue 7 years ago • 1 comments

Conforming Bugs

  • [x] basic information
    • Gentoo Linux, kernel 4.18.5
    • Emacs GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2018-08-24
    • Nim and nimsuggest version 0.19.0
  • [x] Are you using latest version of nim-mode? Yes, 0.4.2 from MELPA.
  • [ ] Are there message related to nim-mode in *Messages* buffer? No.
  • [x] Did you read README.md?

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

ogdenwebb avatar Oct 05 '18 19:10 ogdenwebb

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

larme avatar Jan 14 '20 09:01 larme