Closed frm closed 4 years ago
On a sidenote: as a byproduct of this, I managed to add some missing tests for Elixir and I'm currently working my way through maps and arrays via sigils.
I'll be making a few more PRs adding those.
Thanks for reviewing! I'll be handling these later today.
I did have some issues running the tests with indentation (especially adding tests to existing do-blocks on a different branch) because macvim also has some issues with indentation. It'd really help if I could add a submodule for vim-elixir
.
In fact, it already depends on it since the delimiters used in sp#elixir#SplitArray()
are in fact provided by vim-elixir
. I actually forgot to mention in the PR description, but I assumed that dependency since I'm 99.99% certain someone working with Elixir in Vim to the point they'd need to use splitjoin, would be using vim-elixir
. I think a similar dependency already exists with the Ruby parser and vim-ruby
.
I assumed that dependency since I'm 99.99% certain someone working with Elixir in Vim to the point they'd need to use splitjoin, would be using vim-elixir. I think a similar dependency already exists with the Ruby parser and vim-ruby.
Yes, there's a lot of dependencies, to Rust as well. A couple of days ago, I decided to vendor these in specs, and this seems to be working fine. Here's the lines that load the plugins: https://github.com/AndrewRadev/splitjoin.vim/blob/99d12007112b63b8e3fd0fcf435471ac63ccf030/spec/spec_helper.rb#L14-L16
And here's the .gitmodules
file: https://github.com/AndrewRadev/splitjoin.vim/blob/master/.gitmodules
So, you could do the same for vim-elixir, but I can do that for you as well -- if you'd like, focus on your fix and I'll get the tests running afterwards.
Sorry it took me a couple of months but finally got to handle this. I think these scenarios should now all be handled :)
This PR adds support for array splitting and joining in Elixir.
Works with the following examples:
I did manage to find an edge case where this doesn't work:
However, to handle this it's necessary to build a parser and given it's such an uncommon edge case (updating a map when declaring the last element of an array), I assumed it wouldn't be worth the effort.