CKolkey / ts-node-action

Neovim Plugin for running functions on nodes.
359 stars 20 forks source link

Add R multiline support #44

Closed fbearoff closed 1 year ago

fbearoff commented 1 year ago

This adds preliminary support for multiline toggle in R for function definition formal parameters and argument lists. Marking as draft as I can not figure out how to get the first argument to start on a newline, as the "arguments" node does not include the surrounding parenthesis, unlike the "formal_parameters" node.

Ideally this is how it would function

foo('bar', 'baz')

foo(
  'bar',
  'baz'
)
CKolkey commented 1 year ago

When you have a chance, could you add a spec for the other direction of each toggle?

fbearoff commented 1 year ago

No prob, in there now

fbearoff commented 1 year ago

Had to write a custom function to return the arguments of a function call. This is my real first piece of lua code, not sure my approach is the cleanest or most efficient. Tried to mirror the style of the ruby and python custom actions as much as possible.

CKolkey commented 1 year ago

Hey! Looks pretty reasonable. I don't use R, so I'll take your word for it that this is working as desired. Thanks for the contribution :)