@@ -80,6 +80,7 @@ fn exit(cx: &mut compositor::Context, args: Args, event: PromptEvent) -> anyhow:
8080 WriteOptions {
8181 force : false ,
8282 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
83+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
8384 } ,
8485 ) ?;
8586 }
@@ -99,6 +100,7 @@ fn force_exit(cx: &mut compositor::Context, args: Args, event: PromptEvent) -> a
99100 WriteOptions {
100101 force : true ,
101102 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
103+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
102104 } ,
103105 ) ?;
104106 }
@@ -413,7 +415,11 @@ fn write_impl(
413415 None
414416 } ;
415417
416- let job = code_actions_on_save ( cx, doc_id, fmt) ;
418+ let job = if options. code_actions {
419+ code_actions_on_save ( cx, doc_id, fmt)
420+ } else {
421+ fmt
422+ } ;
417423
418424 if let Some ( job) = job {
419425 cx. jobs . add ( job) ;
@@ -489,6 +495,7 @@ fn insert_final_newline(doc: &mut Document, view_id: ViewId) {
489495pub struct WriteOptions {
490496 pub force : bool ,
491497 pub auto_format : bool ,
498+ pub code_actions : bool ,
492499}
493500
494501fn write ( cx : & mut compositor:: Context , args : Args , event : PromptEvent ) -> anyhow:: Result < ( ) > {
@@ -502,6 +509,7 @@ fn write(cx: &mut compositor::Context, args: Args, event: PromptEvent) -> anyhow
502509 WriteOptions {
503510 force : false ,
504511 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
512+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
505513 } ,
506514 )
507515}
@@ -517,6 +525,7 @@ fn force_write(cx: &mut compositor::Context, args: Args, event: PromptEvent) ->
517525 WriteOptions {
518526 force : true ,
519527 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
528+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
520529 } ,
521530 )
522531}
@@ -536,6 +545,7 @@ fn write_buffer_close(
536545 WriteOptions {
537546 force : false ,
538547 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
548+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
539549 } ,
540550 ) ?;
541551
@@ -558,6 +568,7 @@ fn force_write_buffer_close(
558568 WriteOptions {
559569 force : true ,
560570 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
571+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
561572 } ,
562573 ) ?;
563574
@@ -746,6 +757,7 @@ fn write_quit(cx: &mut compositor::Context, args: Args, event: PromptEvent) -> a
746757 WriteOptions {
747758 force : false ,
748759 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
760+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
749761 } ,
750762 ) ?;
751763 cx. block_try_flush_writes ( ) ?;
@@ -767,6 +779,7 @@ fn force_write_quit(
767779 WriteOptions {
768780 force : true ,
769781 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
782+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
770783 } ,
771784 ) ?;
772785 cx. block_try_flush_writes ( ) ?;
@@ -811,6 +824,7 @@ pub struct WriteAllOptions {
811824 pub force : bool ,
812825 pub write_scratch : bool ,
813826 pub auto_format : bool ,
827+ pub code_actions : bool ,
814828}
815829
816830pub fn write_all_impl (
@@ -881,7 +895,11 @@ pub fn write_all_impl(
881895 None
882896 } ;
883897
884- let job = code_actions_on_save ( cx, doc_id, fmt) ;
898+ let job = if options. code_actions {
899+ code_actions_on_save ( cx, doc_id, fmt)
900+ } else {
901+ fmt
902+ } ;
885903
886904 if let Some ( job) = job {
887905 cx. jobs . add ( job) ;
@@ -908,6 +926,7 @@ fn write_all(cx: &mut compositor::Context, args: Args, event: PromptEvent) -> an
908926 force : false ,
909927 write_scratch : true ,
910928 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
929+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
911930 } ,
912931 )
913932}
@@ -927,6 +946,7 @@ fn force_write_all(
927946 force : true ,
928947 write_scratch : true ,
929948 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
949+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
930950 } ,
931951 )
932952}
@@ -945,6 +965,7 @@ fn write_all_quit(
945965 force : false ,
946966 write_scratch : true ,
947967 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
968+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
948969 } ,
949970 ) ?;
950971 quit_all_impl ( cx, false )
@@ -964,6 +985,7 @@ fn force_write_all_quit(
964985 force : true ,
965986 write_scratch : true ,
966987 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
988+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
967989 } ,
968990 ) ;
969991 quit_all_impl ( cx, true )
@@ -1527,6 +1549,7 @@ fn update(cx: &mut compositor::Context, args: Args, event: PromptEvent) -> anyho
15271549 WriteOptions {
15281550 force : false ,
15291551 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
1552+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
15301553 } ,
15311554 )
15321555 } else {
0 commit comments