processing-r / Processing.R

R Language Mode in Processing for Creative Coding, created by @gaocegege, maintained by @jeremydouglass
https://processing-r.github.io/
GNU General Public License v3.0
141 stars 16 forks source link

R Language Formatter in Editor #84

Open gaocegege opened 7 years ago

gaocegege commented 7 years ago

Now there is no formatter to format the code, we need to import or implement one.

  /**
   * @see processing.app.ui.Editor#createFormatter()
   */
  @Override
  public Formatter createFormatter() {
    return null;
  }
jeremydouglass commented 7 years ago

Perhaps use formatR?

gaocegege commented 7 years ago

Yes, it may works, and I have some connections with the authors of formatR, so we have technical support :smile:

jeremydouglass commented 7 years ago

What are we currently using for checking R code formatting on the repository? Ideally the Example Processing.R sketches will both:

  1. be unchanged when running the PDE R autoformatter
  2. pass continuous integration code checks on the repository
gaocegege commented 7 years ago

We are using FormatRBear in coala, and its backend is formatR.

gaocegege commented 7 years ago

Yeah, I agree with you :)

gaocegege commented 7 years ago

Try to use formatR, which means if the user wanna to use the formatter, he/she needs R installed.

jeremydouglass commented 7 years ago

if the user wanna to use the formatter, he/she needs R installed

As an alternative to the user installing R or to us including a full separate R install just for the PDE formatter...

Does formatR run in renjin?

http://packages.renjin.org/package/org.renjin.cran/formatR/1.2.1

Perhaps we could have the autoformatter call formatR through renjin, if it isn't too slow?

gaocegege commented 7 years ago

We could have a try but there are 5 tests failed.

jeremydouglass commented 7 years ago

I see -- then I think it is probably not worth trying.

gaocegege commented 6 years ago

There are some ways: