RefactoringTools / wrangler

Wrangler -- An Erlang Refactorer
https://refactoringtools.github.io/wrangler/
Other
165 stars 45 forks source link

Vim Integration #85

Open leostera opened 7 years ago

leostera commented 7 years ago

Hi! I just found out about this tool through the erlang user mailing list and I'm wondering if there's any interest on your end to do integrate with vim, a-la Ocaml's merlin.

I'd be more than happy to look into it if you can give me some pointers :)

simonjohnthompson commented 7 years ago

Hi Leandro - here’s a start. And, yes, we’re really interested in integration.

Wrangler is written in Erlang, and refactorings are calls to Erlang functions that change files in the project. So, the integration requires a separately running Erlang runtime, and the ability to pass information to it from vim, and accept (some) information back. Information going to Wrangler is typically some representation of the erlang function calls, so function name, parameters (module name, position of cursor / selection etc); information coming back is less structured.

That gives the starting requirements, but interactions can be more sophisticated. For example, in “folding” instances of function bodies into function calls, an interaction can visit in sequence each of the possibilities, and get an interactive answer to whether that instance is to be folded.

We did have vim integration in HaRe, the Haskell refactorer, and you should be able to find the code for that in the repo:

https://github.com/alanz/HaRe https://github.com/alanz/HaRe

Be aware, though, that this was done about 15 years ago (!) and mechanisms in vim / vi for linking to external processes and for biilding plugins may well have improved.

Kind regards

Simon

On 27 Jun 2017, at 14:55, Leandro Ostera notifications@github.com wrote:

Hi! I just found out about this tool through the erlang user mailing list and I'm wondering if there's any interest on your end to do integrate with vim, a-la Ocaml's merlin.

I'd be more than happy to look into it if you can give me some pointers :)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/RefactoringTools/wrangler/issues/85, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmtcAJUVD-wHJsG1mboyWC8SXLBNSDcks5sIUIBgaJpZM4OG-gE.

Simon Thompson | Professor of Logic and Computation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thompson@kent.ac.uk mailto:s.j.thompson@kent.ac.uk | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt http://www.cs.kent.ac.uk/~sjt

huiqing commented 7 years ago

Hi Leandro, hi Simon,

It might worth taking a look at this repository first.

https://github.com/ppikula/vim-wrangler/tree/master/ftplugin

Regards, Huiqing

from my iPhone

On 1 Jul 2017, at 11:53, simonjohnthompson notifications@github.com<mailto:notifications@github.com> wrote:

Hi Leandro - here’s a start. And, yes, we’re really interested in integration.

Wrangler is written in Erlang, and refactorings are calls to Erlang functions that change files in the project. So, the integration requires a separately running Erlang runtime, and the ability to pass information to it from vim, and accept (some) information back. Information going to Wrangler is typically some representation of the erlang function calls, so function name, parameters (module name, position of cursor / selection etc); information coming back is less structured.

That gives the starting requirements, but interactions can be more sophisticated. For example, in “folding” instances of function bodies into function calls, an interaction can visit in sequence each of the possibilities, and get an interactive answer to whether that instance is to be folded.

We did have vim integration in HaRe, the Haskell refactorer, and you should be able to find the code for that in the repo:

https://github.com/alanz/HaRe https://github.com/alanz/HaRe

Be aware, though, that this was done about 15 years ago (!) and mechanisms in vim / vi for linking to external processes and for biilding plugins may well have improved.

Kind regards

Simon

On 27 Jun 2017, at 14:55, Leandro Ostera notifications@github.com<mailto:notifications@github.com> wrote:

Hi! I just found out about this tool through the erlang user mailing list and I'm wondering if there's any interest on your end to do integrate with vim, a-la Ocaml's merlin.

I'd be more than happy to look into it if you can give me some pointers :)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/RefactoringTools/wrangler/issues/85, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmtcAJUVD-wHJsG1mboyWC8SXLBNSDcks5sIUIBgaJpZM4OG-gE.

Simon Thompson | Professor of Logic and Computation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thompson@kent.ac.ukmailto:s.j.thompson@kent.ac.uk mailto:s.j.thompson@kent.ac.uk | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjthttp://www.cs.kent.ac.uk/~sjt http://www.cs.kent.ac.uk/~sjt

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/RefactoringTools/wrangler/issues/85#issuecomment-312425289, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAk6X8f6-sbwKBuHHPhtHt7xRRn4v0cOks5sJiUqgaJpZM4OG-gE.

NOTICE AND DISCLAIMER This email contains BT information, which may be privileged or confidential. It's meant only for the individual(s) or entity named above. If you're not the intended recipient, note that disclosing, copying, distributing or using this information is prohibited. If you've received this email in error, please let me know immediately on the email address above. Thank you.

We monitor our email system, and may record your emails.

EE Limited Registered office:Trident Place, Mosquito Way, Hatfield, Hertfordshire, AL10 9BW Registered in England no: 02382161

EE Limited is a wholly owned subsidiary of:

British Telecommunications plc Registered office: 81 Newgate Street London EC1A 7AJ Registered in England no: 1800000

simonjohnthompson commented 7 years ago

Yes, indeed! Thanks!

Simon

On 1 Jul 2017, at 08:16, Huiqing notifications@github.com wrote:

Hi Leandro, hi Simon,

It might worth taking a look at this repository first.

https://github.com/ppikula/vim-wrangler/tree/master/ftplugin https://github.com/ppikula/vim-wrangler/tree/master/ftplugin

Regards, Huiqing

Simon Thompson | Professor of Logic and Computation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thompson@kent.ac.uk mailto:s.j.thompson@kent.ac.uk | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt http://www.cs.kent.ac.uk/~sjt

johnzeng commented 7 years ago

@ostera You can also try my repo vim-erlang , I [oscarh/vimerl] , I copied the refactor codes from ( https://github.com/oscarh/vimerl) and did some bug fixes. But i use my own indent setting in this repo, I can pull the refactor codes out if necessary