vim-erlang / vim-erlang-runtime

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

opt25 syntax `maybe` support #54

Closed haoxianhan closed 2 years ago

hcs42 commented 2 years ago

Thank you for your contribution.

I pushed a commit with a few updates to https://github.com/hcs42/vim-erlang-runtime/commits/maybe_expr. Could you check it?

A few notes:

  1. I attached my modifications as a diff: maybe-diff.txt.
  2. I pushed a few commits to master where I improved test_indent.vim. I rebased the maybe commit on the top of the new master.
  3. My modifications to indent/erlang.vim were mostly about handling maybe and else similar to receive and after. The indentation script handles receive and after mostly well in different kinds of non-typical code layout, so adding maybe and else made sure that we handle them well too. Just one example: without the modifications, the script failed to indent catch expressions after the maybe keyword.

    f() ->
        maybe
        catch X
  4. I fixed a few earlier mistakes in comments already present in the indentation script. For example, in a previous refactoring, I accidentally deleted the text if already empty from a comment in line 595. Now I added it back.
  5. I added test cases about maybe to test_indent.vim. These test cases are good way to find the edge cases I mentioned in point 3. The README contains a Developing and testing the indentation script section that is useful when working with the indentation script and its test file.
haoxianhan commented 2 years ago

I use your repo's new branch maybe_expr in recent days, I generally use a few kinds of maybe block such as [test/test_syntax.erl](https://github.com/vim-erlang/vim-erlang-runtime/pull/54/files#diff-eb85353a0f590a9c2ad4d6aa3288e4c61837b8589ac6e056e3c6720500b0fd32). It did work fine so far.

hcs42 commented 2 years ago

Thank you for the feedback. Would you force push the commit in my branch to haoxianhan:master? Afterwards I could merge the PR.

haoxianhan commented 2 years ago

I've updated my master branch, thanks for the review. 👍