-
Notifications
You must be signed in to change notification settings - Fork 453
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
Support for Rust #358
Comments
https://github.com/nrc/rustfmt might be helpful |
Excellent, @nicokoch! That looks great. For those interested in making this happen, you can submit a Pull Request. I am still working on complete documentation however I have documented most of the steps required to add a new Language and a new Beautifier: #300 (comment) |
I have started development on the Rustfmt beautifier support however I have not tested it and it likely is not in a working state, yet. Feel free to fork Atom Beautify, and try it out for yourself and submit a Pull Request when it's completely working. Thanks. Update: I've published my current progress to v0.27.11 |
I will be maintaining this documentation on adding languages and beautifiers: https://github.com/Glavin001/atom-beautify/blob/master/docs/add-languages-and-beautifiers.md |
Rustfmt works correctly. The only extra step I had to do was copy the default.toml file from the Rustfmt project into my home directory. |
It seems there's a problem with the way rustfmt is used by Beautify. When trying to do a format, I get the following error.
It seems that rustfmt is expecting the entire cargo project to be in the location it wants to format it. |
There is another problem. rustfmt supports having a config file next to the source file or further up the directory tree. Because atom-beautify copies the source file to /tmp/ (at least on my system - Arch Linux), rustfmt does not find the config file and just applies the default config. The only "workaround" is moving my config to system root, which applies it globally. Not exactly optimal. |
Please feel free to submit a Pull request for rustfmt support in Atom Beautify. |
https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/clang-format.coffee could probably be seen as a reference model how rustfmt needs to be invoked like. I tried to modify the code myself, but gave up after a while since I failed to understand how this project works. Maybe someone with more experience could copy over and integrate the code. 😊 Otherwise the file content could just be piped into a rustfmt instance to replace the editor contents with it's ouputs before saving and thus circumvent any kind of slow disk access. |
I have working version of Beautifier support for rustfmt.toml at https://github.com/sidred/atom-beautify/tree/rustfmt-update. Waiting for rust-lang/rustfmt#780 to be merged before submititng a PR. |
@sidred looks like it has been merged. any update? |
Merged via #790. Beautifier should read the rustfmt.toml in the file path. |
rustfmt development recently has been moved to rustfmt-nightly branch, which original rustfmt being frozen. As a side effect of that change, the version numbering has been reset back to 0.1.x. However, atom-beautify check for the version being higher than 0.5. Naturally, it comes to the wrong conclusion with rustfmt-nightly as not being good enough. Fortunately, it is easy to distinguish between the two branches - as nightly clearly says so in its
It would be great to add extra check for running newer branch of rustfmt and clear it for using inside atom-beautify |
Pull Requests welcome! See https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/rustfmt.coffee for applicable code. I am not a Rust user/developer, so it is unlikely I would write the Pull Request. However, I will be happy to review and merge any changes. Thanks in advance! |
Published to v0.30.5 |
Please add support for the Rust language. Rust 1.0 was released on 05-15-2015 and the syntax is stable now.
The text was updated successfully, but these errors were encountered: