Merge pull request #790 from sidred/rustfmt-update
Rust - Add ability to read rustfmt.toml
This commit is contained in:
commit
e74746d32f
|
@ -14,9 +14,19 @@ module.exports = class Rustfmt extends Beautifier
|
|||
}
|
||||
|
||||
beautify: (text, language, options) ->
|
||||
|
||||
# get file path which is the search path for rustfmt.toml as
|
||||
# the beautifier runs rustfmt in a tmp directory.
|
||||
# This will pick up any rustfmt.toml defined in the crate root
|
||||
|
||||
editor = atom.workspace.getActivePaneItem()
|
||||
file = editor?.buffer.file
|
||||
filePath = file?.path
|
||||
program = options.rustfmt_path or "rustfmt"
|
||||
@run(program, [
|
||||
tmpFile = @tempFile("tmp", text)
|
||||
["--write-mode", "overwrite"]
|
||||
["--config-path", filePath]
|
||||
], help: {
|
||||
link: "https://github.com/nrc/rustfmt"
|
||||
program: "rustfmt"
|
||||
|
|
Loading…
Reference in New Issue