File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
crates/ra_lsp_server/src/main_loop Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 11//! This module is responsible for implementing handlers for Lanuage Server Protocol.
22//! The majority of requests are fulfilled by calling into the `ra_ide` crate.
33
4- use std:: { fmt:: Write as _, io:: Write as _} ;
4+ use std:: {
5+ fmt:: Write as _,
6+ io:: Write as _,
7+ process:: { self , Stdio } ,
8+ } ;
59
610use either:: Either ;
711use lsp_server:: ErrorCode ;
@@ -582,21 +586,19 @@ pub fn handle_formatting(
582586 let file_line_index = world. analysis ( ) . file_line_index ( file_id) ?;
583587 let end_position = TextUnit :: of_str ( & file) . conv_with ( & file_line_index) ;
584588
585- use std:: process;
586589 let mut rustfmt = process:: Command :: new ( "rustfmt" ) ;
587590 if let Some ( & crate_id) = crate_ids. first ( ) {
588591 // Assume all crates are in the same edition
589592 let edition = world. analysis ( ) . crate_edition ( crate_id) ?;
590593 rustfmt. args ( & [ "--edition" , & edition. to_string ( ) ] ) ;
591594 }
592- rustfmt. stdin ( process:: Stdio :: piped ( ) ) . stdout ( process:: Stdio :: piped ( ) ) ;
593595
594596 if let Ok ( path) = params. text_document . uri . to_file_path ( ) {
595597 if let Some ( parent) = path. parent ( ) {
596598 rustfmt. current_dir ( parent) ;
597599 }
598600 }
599- let mut rustfmt = rustfmt. spawn ( ) ?;
601+ let mut rustfmt = rustfmt. stdin ( Stdio :: piped ( ) ) . stdout ( Stdio :: piped ( ) ) . spawn ( ) ?;
600602
601603 rustfmt. stdin . as_mut ( ) . unwrap ( ) . write_all ( file. as_bytes ( ) ) ?;
602604
You can’t perform that action at this time.
0 commit comments