Allow providing an external format in format_on_save
setting
This commit is contained in:
parent
4ec2d6e50d
commit
c6254247c3
4 changed files with 200 additions and 89 deletions
|
@ -352,13 +352,8 @@ impl Item for Editor {
|
|||
project: ModelHandle<Project>,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Task<Result<()>> {
|
||||
let settings = cx.global::<Settings>();
|
||||
let buffer = self.buffer().clone();
|
||||
let mut buffers = buffer.read(cx).all_buffers();
|
||||
buffers.retain(|buffer| {
|
||||
let language_name = buffer.read(cx).language().map(|l| l.name());
|
||||
settings.format_on_save(language_name.as_deref())
|
||||
});
|
||||
let buffers = buffer.read(cx).all_buffers();
|
||||
let mut timeout = cx.background().timer(FORMAT_TIMEOUT).fuse();
|
||||
let format = project.update(cx, |project, cx| project.format(buffers, true, cx));
|
||||
cx.spawn(|this, mut cx| async move {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue