Is there a formatter/linter for Ron?
Is there a formatter or linter for ron available for vscode? The vscode-ron extension seems to do syntax highlighting but not formatting.
I haven't seen any. It would be great to have!
Yeah, and there could also be a ron::to_string_pretty()!Do you know how one would go about this? Would it just take a lot of regex and elbow grease?On 18 Apr 2022 2:03 pm, Dzmitry Malyshau @.***> wrote:
I haven't seen any. It would be great to have!
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>
There is ron::ser::to_string_pretty If you were looking for that :)
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.
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?
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.
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} .
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.
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_prettyexisted from the documentation, but it took me a while to realize that where I had importedron::to_stringshould have beenron::ser::to_stringbefore I could import both at the same scope likeron::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.
This seems like an only option to format ron files atm: https://github.com/barafael/ronfmt
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.
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.