vim-erlang / vim-erlang-runtime

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

Respect comma first style #41

Open 88maomao opened 6 years ago

88maomao commented 6 years ago

Make following formatting style possible

-export([ respect/1
        , first/2
        , comma/3]).
hcs42 commented 6 years ago

If I have an Erlang file such as this one:

f() ->
    1
        , 2.

and try to indent the last line, it doesn't move.

If I source helper.vim and hit shift-F3, it shows the error:

Indenting line 3:     , 2.
  Line type = 'first comma'
Tokenizing starts from line 2
Tokenizing line 2:     1
  Tokens in the line:
    - ['1', 4, 4]
  Analyzing the following token: ['1', 4, 4]
    Misc token, stack unchanged = ['first_comma']
    Token processed. stored_vcol=-1
  Line analyzed. stored_vcol=-1
Tokenizing starts from line 1
Tokenizing line 1: f() ->
  Tokens in the line:
    - ['f', 0, 0]
    - ['(', 1, 1]
    - [')', 2, 2]
    - ['->', 4, 4]
  Analyzing the following token: ['->', 4, 4]
    Unexpected token ->, stack = ['first_comma'] -> return
ErlangCalcIndent returned: -1