vim-erlang / vim-erlang-runtime

Erlang indentation and syntax for Vim
https://vim-erlang.github.io
101 stars 29 forks source link

incorrectly indented record fields after :: fun() spec #16

Closed michalwski closed 11 years ago

michalwski commented 11 years ago
-record(state,
        {step = 2              :: 2 | 4,
         stored_key = <<"">>   :: binary(),
         server_key = <<"">>   :: binary(),
         username = <<"">>     :: binary(),
         get_password          :: fun(),
                                      check_password        :: fun(),
                                                                   auth_message = <<"">> :: binary(),
                                                                   client_nonce = <<"">> :: binary(),
                                                                   server_nonce = <<"">> :: binary()}).

should be:

-record(state,
        {step = 2              :: 2 | 4,
         stored_key = <<"">>   :: binary(),
         server_key = <<"">>   :: binary(),
         username = <<"">>     :: binary(),
         get_password          :: fun(),
         check_password        :: fun(),
         auth_message = <<"">> :: binary(),
         client_nonce = <<"">> :: binary(),
         server_nonce = <<"">> :: binary()}).
hcs42 commented 11 years ago

Currently type specifications are not handled at all – i.e. they will be indented as if they were plain Erlang code. So in the code above, the indentation script will think that fun() is the beginning of a fun.

There is a ticket about making type specs work in general (#2), so I'm closing this ticket.