See #358. Add Rustfmt beautifier for Rust language support
This commit is contained in:
parent
5469dd56bd
commit
b0d8d7dd1e
|
@ -586,6 +586,15 @@ Indentation size/length (Supported by autopep8)
|
|||
**Description**:
|
||||
|
||||
do not fix these errors/warnings (Supported by autopep8)
|
||||
### Rust - Rustfmt path
|
||||
|
||||
**Key**: `rust_rustfmt_path`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Description**:
|
||||
|
||||
Path to rustfmt program (Supported by rustfmt)
|
||||
### SQL - Indent size
|
||||
|
||||
**Key**: `sql_indent_size`
|
||||
|
@ -1469,6 +1478,37 @@ Default Beautifier to be used for Ruby
|
|||
**Description**:
|
||||
|
||||
Automatically beautify Ruby files on save
|
||||
### Language Config - Rust - Disable Beautifying Language
|
||||
|
||||
**Key**: `language_rust_disabled`
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Description**:
|
||||
|
||||
Disable Rust Beautification
|
||||
### Language Config - Rust - Default Beautifier
|
||||
|
||||
**Key**: `language_rust_default_beautifier`
|
||||
|
||||
**Default**: `rustfmt`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Enum**: `rustfmt`
|
||||
|
||||
**Description**:
|
||||
|
||||
Default Beautifier to be used for Rust
|
||||
### Language Config - Rust - Beautify On Save
|
||||
|
||||
**Key**: `language_rust_beautify_on_save`
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Description**:
|
||||
|
||||
Automatically beautify Rust files on save
|
||||
### Language Config - Sass - Disable Beautifying Language
|
||||
|
||||
**Key**: `language_sass_disabled`
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
println!("hello, world");
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
println!("hello, world");
|
||||
}
|
|
@ -46,6 +46,7 @@ module.exports = class Beautifiers
|
|||
'prettydiff'
|
||||
'rubocop'
|
||||
'ruby-beautify'
|
||||
'rustfmt'
|
||||
'sqlformat'
|
||||
'tidy-markdown'
|
||||
'typescript-formatter'
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
###
|
||||
Requires https://github.com/nrc/rustfmt
|
||||
###
|
||||
|
||||
"use strict"
|
||||
Beautifier = require('./beautifier')
|
||||
|
||||
module.exports = class rustfmt extends Beautifier
|
||||
|
||||
name: "rustfmt"
|
||||
|
||||
options: {
|
||||
Rust: true
|
||||
}
|
||||
|
||||
beautify: (text, language, options) ->
|
||||
program = options.rustfmt_path or "rustfmt"
|
||||
@run(program, [
|
||||
tmpFile = @tempFile("tmp", text)
|
||||
], help: {
|
||||
link: "https://github.com/nrc/rustfmt"
|
||||
program: "rustfmt"
|
||||
pathOption: "Rust - Rustfmt Path"
|
||||
})
|
||||
.then(=>
|
||||
@readFile(tmpFile)
|
||||
)
|
|
@ -39,6 +39,7 @@ module.exports = class Languages
|
|||
"php"
|
||||
"python"
|
||||
"ruby"
|
||||
"rust"
|
||||
"sass"
|
||||
"scss"
|
||||
"spacebars"
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
module.exports = {
|
||||
|
||||
name: "Rust"
|
||||
namespace: "rust"
|
||||
|
||||
###
|
||||
Supported Grammars
|
||||
###
|
||||
grammars: [
|
||||
"Rust"
|
||||
]
|
||||
|
||||
###
|
||||
Supported extensions
|
||||
###
|
||||
extensions: [
|
||||
"rs"
|
||||
"rlib"
|
||||
]
|
||||
|
||||
options:
|
||||
rustfmt_path:
|
||||
type: 'string'
|
||||
default: ""
|
||||
description: "Path to rustfmt program"
|
||||
|
||||
}
|
Loading…
Reference in New Issue