@@ -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 }
@@ -420,7 +422,11 @@ fn write_impl(
420422 None
421423 } ;
422424
423- let job = code_actions_on_save ( cx, doc_id, fmt) ;
425+ let job = if options. code_actions {
426+ code_actions_on_save ( cx, doc_id, fmt)
427+ } else {
428+ fmt
429+ } ;
424430
425431 if let Some ( job) = job {
426432 cx. jobs . add ( job) ;
@@ -496,6 +502,7 @@ fn insert_final_newline(doc: &mut Document, view_id: ViewId) {
496502pub struct WriteOptions {
497503 pub force : bool ,
498504 pub auto_format : bool ,
505+ pub code_actions : bool ,
499506}
500507
501508fn write ( cx : & mut compositor:: Context , args : Args , event : PromptEvent ) -> anyhow:: Result < ( ) > {
@@ -509,6 +516,7 @@ fn write(cx: &mut compositor::Context, args: Args, event: PromptEvent) -> anyhow
509516 WriteOptions {
510517 force : false ,
511518 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
519+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
512520 } ,
513521 )
514522}
@@ -524,6 +532,7 @@ fn force_write(cx: &mut compositor::Context, args: Args, event: PromptEvent) ->
524532 WriteOptions {
525533 force : true ,
526534 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
535+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
527536 } ,
528537 )
529538}
@@ -543,6 +552,7 @@ fn write_buffer_close(
543552 WriteOptions {
544553 force : false ,
545554 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
555+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
546556 } ,
547557 ) ?;
548558
@@ -565,6 +575,7 @@ fn force_write_buffer_close(
565575 WriteOptions {
566576 force : true ,
567577 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
578+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
568579 } ,
569580 ) ?;
570581
@@ -753,6 +764,7 @@ fn write_quit(cx: &mut compositor::Context, args: Args, event: PromptEvent) -> a
753764 WriteOptions {
754765 force : false ,
755766 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
767+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
756768 } ,
757769 ) ?;
758770 cx. block_try_flush_writes ( ) ?;
@@ -774,6 +786,7 @@ fn force_write_quit(
774786 WriteOptions {
775787 force : true ,
776788 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
789+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
777790 } ,
778791 ) ?;
779792 cx. block_try_flush_writes ( ) ?;
@@ -818,6 +831,7 @@ pub struct WriteAllOptions {
818831 pub force : bool ,
819832 pub write_scratch : bool ,
820833 pub auto_format : bool ,
834+ pub code_actions : bool ,
821835}
822836
823837pub fn write_all_impl (
@@ -891,7 +905,11 @@ pub fn write_all_impl(
891905 None
892906 } ;
893907
894- let job = code_actions_on_save ( cx, doc_id, fmt) ;
908+ let job = if options. code_actions {
909+ code_actions_on_save ( cx, doc_id, fmt)
910+ } else {
911+ fmt
912+ } ;
895913
896914 if let Some ( job) = job {
897915 cx. jobs . add ( job) ;
@@ -918,6 +936,7 @@ fn write_all(cx: &mut compositor::Context, args: Args, event: PromptEvent) -> an
918936 force : false ,
919937 write_scratch : true ,
920938 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
939+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
921940 } ,
922941 )
923942}
@@ -937,6 +956,7 @@ fn force_write_all(
937956 force : true ,
938957 write_scratch : true ,
939958 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
959+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
940960 } ,
941961 )
942962}
@@ -955,6 +975,7 @@ fn write_all_quit(
955975 force : false ,
956976 write_scratch : true ,
957977 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
978+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
958979 } ,
959980 ) ?;
960981 quit_all_impl ( cx, false )
@@ -974,6 +995,7 @@ fn force_write_all_quit(
974995 force : true ,
975996 write_scratch : true ,
976997 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
998+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
977999 } ,
9781000 ) ;
9791001 quit_all_impl ( cx, true )
@@ -1537,6 +1559,7 @@ fn update(cx: &mut compositor::Context, args: Args, event: PromptEvent) -> anyho
15371559 WriteOptions {
15381560 force : false ,
15391561 auto_format : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
1562+ code_actions : !args. has_flag ( WRITE_NO_FORMAT_FLAG . name ) ,
15401563 } ,
15411564 )
15421565 } else {
0 commit comments