Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a formatter/linter for Ron? #377

Open
sashinexists opened this issue Apr 17, 2022 · 12 comments
Open

Is there a formatter/linter for Ron? #377

sashinexists opened this issue Apr 17, 2022 · 12 comments
Labels
alternative Suggested alternative formats enhancement

Comments

@sashinexists
Copy link

Is there a formatter or linter for ron available for vscode? The vscode-ron extension seems to do syntax highlighting but not formatting.

@kvark
Copy link
Collaborator

kvark commented Apr 18, 2022

I haven't seen any. It would be great to have!

@sashinexists
Copy link
Author

sashinexists commented Apr 18, 2022 via email

@juntyr
Copy link
Member

juntyr commented Apr 18, 2022

There is ron::ser::to_string_pretty If you were looking for that :)

@maurges
Copy link

maurges commented May 18, 2022

Hello. There exists a formatter I have been using privately, it's based on an alternative RON implementation. I have now uploaded it here, including static binary files from the two platforms I use. Here is the link: https://gist.github.com/d86leader/c6d10e0fd329c75925cd42c8fc9ab7d5

P.S.
I also have it on good intel that the author of that alternative implementation will in the near future be releasing a ron-multitool with formatting and selecting different fields and other stuff. ;)
It should have come out in the early spring, but the war has delayed the plans.

@Type1J
Copy link

Type1J commented Jan 3, 2023

Can ron::ser::to_string_pretty and ron::ser::PrettyOptions be exported in lib.rs like ron::ser::to_string is (to make it accessable at ron::to_string_pretty), or is there a reason that is isn't?

@juntyr
Copy link
Member

juntyr commented Jan 4, 2023

It definitely could, though I'm personally a bit sceptical of having too many items in the root module. If this is mainly about discovery, we could perhaps link to to_string_pretty in to_string's documentation.

@Type1J
Copy link

Type1J commented Jan 9, 2023

If that's a concern, then a documentation link may be the best solution.

I'm not sure how you'll address it, but here's my thoughts on the matter:
I knew that to_string_pretty existed from the documentation, but it took me a while to realize that where I had imported ron::to_string should have been ron::ser::to_string before I could import both at the same scope like ron::ser::{to_string, to_string_pretty} .

@ModProg
Copy link
Contributor

ModProg commented Mar 12, 2023

I also have it on good intel that the author of that alternative implementation will in the near future be releasing a ron-multitool with formatting and selecting different fields and other stuff. ;)

Any updates on that? I just started working on my own ron formatter (but in rust) but would be interested in any other implementations.

@juntyr
Copy link
Member

juntyr commented Mar 13, 2023

If that's a concern, then a documentation link may be the best solution.

I'm not sure how you'll address it, but here's my thoughts on the matter: I knew that to_string_pretty existed from the documentation, but it took me a while to realize that where I had imported ron::to_string should have been ron::ser::to_string before I could import both at the same scope like ron::ser::{to_string, to_string_pretty} .

#440 finally adds some docs improvements and I've made the to_string_pretty more prominent in the README.

@makscee
Copy link

makscee commented Aug 15, 2023

This seems like an only option to format ron files atm: https://github.com/barafael/ronfmt

@ModProg
Copy link
Contributor

ModProg commented Aug 23, 2023

This seems like an only option to format ron files atm: https://github.com/barafael/ronfmt

There is also ronda: https://github.com/ModProg/ronda I had written some time ago.

While it doesn't support any configuration, it preserves comments and can format either a list of files ronda *.ron or can format stdin cat file.ron | ronda > file.ron.

While I pushed some changes I made a while ago right now, I'm probably not really continuing this project for now, as I'm considering replacing my ron usages with rsn. Though I am always open for contributions.

@juntyr juntyr added the alternative Suggested alternative formats label Aug 23, 2023
@tadeohepperle
Copy link

tadeohepperle commented Sep 27, 2023

I was able to install ronfmt via cargo install ronfmt. Then I installed the VSCode extension Run on Save and configured it in settings.json like this:

"emeraldwalk.runonsave": {
    "commands": [
      {
        "match": "\\.ron$",
        "ronfmt ${file}"
      }
    ]
  }

Idk, just wanted to share this in case people find it useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alternative Suggested alternative formats enhancement
Projects
None yet
Development

No branches or pull requests

8 participants