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) ->
|
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"
|
program = options.rustfmt_path or "rustfmt"
|
||||||
@run(program, [
|
@run(program, [
|
||||||
tmpFile = @tempFile("tmp", text)
|
tmpFile = @tempFile("tmp", text)
|
||||||
|
["--write-mode", "overwrite"]
|
||||||
|
["--config-path", filePath]
|
||||||
], help: {
|
], help: {
|
||||||
link: "https://github.com/nrc/rustfmt"
|
link: "https://github.com/nrc/rustfmt"
|
||||||
program: "rustfmt"
|
program: "rustfmt"
|
||||||
|
|
Loading…
Reference in New Issue