parent
69fe46a122
commit
278361a086
3 changed files with 11 additions and 3 deletions
|
@ -28,8 +28,8 @@ pub struct LanguageConfiguration {
|
||||||
pub file_types: Vec<String>, // filename ends_with? <Gemfile, rb, etc>
|
pub file_types: Vec<String>, // filename ends_with? <Gemfile, rb, etc>
|
||||||
pub roots: Vec<String>, // these indicate project roots <.git, Cargo.toml>
|
pub roots: Vec<String>, // these indicate project roots <.git, Cargo.toml>
|
||||||
|
|
||||||
// pub path: PathBuf,
|
#[serde(default)]
|
||||||
// root_path for tree-sitter (^)
|
pub auto_format: bool,
|
||||||
|
|
||||||
// content_regex
|
// content_regex
|
||||||
// injection_regex
|
// injection_regex
|
||||||
|
|
|
@ -966,7 +966,13 @@ mod cmd {
|
||||||
editor.set_error("cannot write a buffer without a filename".to_string());
|
editor.set_error("cannot write a buffer without a filename".to_string());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
doc.format(view.id); // TODO: merge into save
|
let autofmt = doc
|
||||||
|
.language_config()
|
||||||
|
.map(|config| config.auto_format)
|
||||||
|
.unwrap_or_default();
|
||||||
|
if autofmt {
|
||||||
|
doc.format(view.id); // TODO: merge into save
|
||||||
|
}
|
||||||
tokio::spawn(doc.save());
|
tokio::spawn(doc.save());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ scope = "source.rust"
|
||||||
injection-regex = "rust"
|
injection-regex = "rust"
|
||||||
file-types = ["rs"]
|
file-types = ["rs"]
|
||||||
roots = []
|
roots = []
|
||||||
|
auto-format = true
|
||||||
|
|
||||||
language-server = { command = "rust-analyzer" }
|
language-server = { command = "rust-analyzer" }
|
||||||
indent = { tab-width = 4, unit = " " }
|
indent = { tab-width = 4, unit = " " }
|
||||||
|
@ -61,6 +62,7 @@ scope = "source.go"
|
||||||
injection-regex = "go"
|
injection-regex = "go"
|
||||||
file-types = ["go"]
|
file-types = ["go"]
|
||||||
roots = ["Gopkg.toml", "go.mod"]
|
roots = ["Gopkg.toml", "go.mod"]
|
||||||
|
auto-format = true
|
||||||
|
|
||||||
language-server = { command = "gopls" }
|
language-server = { command = "gopls" }
|
||||||
# TODO: gopls needs utf-8 offsets?
|
# TODO: gopls needs utf-8 offsets?
|
||||||
|
|
Loading…
Add table
Reference in a new issue