File tree Expand file tree Collapse file tree 2 files changed +20
-20
lines changed Expand file tree Collapse file tree 2 files changed +20
-20
lines changed Original file line number Diff line number Diff line change @@ -59,20 +59,10 @@ pub(crate) fn annotations(
59
59
60
60
let range = runnable. nav . focus_or_full_range ( ) ;
61
61
62
- // dbg_runnable should go after the run annotation, to prevent a clone we do it this way
63
- let dbg_runnable = ( runnable. debugee ( ) && config. debug ) . then ( || Annotation {
62
+ annotations. push ( Annotation {
64
63
range,
65
- kind : AnnotationKind :: Runnable { debug : true , runnable : runnable . clone ( ) } ,
64
+ kind : AnnotationKind :: Runnable { debug : false , runnable } ,
66
65
} ) ;
67
-
68
- if config. run {
69
- annotations. push ( Annotation {
70
- range,
71
- kind : AnnotationKind :: Runnable { debug : false , runnable } ,
72
- } ) ;
73
- }
74
-
75
- annotations. extend ( dbg_runnable) ;
76
66
}
77
67
}
78
68
Original file line number Diff line number Diff line change @@ -998,16 +998,26 @@ pub(crate) fn code_lens(
998
998
let annotation_range = range ( & line_index, annotation. range ) ;
999
999
1000
1000
let title = run. title ( ) ;
1001
+ let can_debug = run. debugee ( ) ;
1001
1002
let r = runnable ( snap, run) ?;
1002
1003
1003
- let command =
1004
- if debug { command:: debug_single ( & r) } else { command:: run_single ( & r, & title) } ;
1005
-
1006
- acc. push ( lsp_types:: CodeLens {
1007
- range : annotation_range,
1008
- command : Some ( command) ,
1009
- data : None ,
1010
- } )
1004
+ let lens_config = snap. config . lens ( ) ;
1005
+ if lens_config. run {
1006
+ let command = command:: run_single ( & r, & title) ;
1007
+ acc. push ( lsp_types:: CodeLens {
1008
+ range : annotation_range,
1009
+ command : Some ( command) ,
1010
+ data : None ,
1011
+ } )
1012
+ }
1013
+ if lens_config. debug && can_debug {
1014
+ let command = command:: debug_single ( & r) ;
1015
+ acc. push ( lsp_types:: CodeLens {
1016
+ range : annotation_range,
1017
+ command : Some ( command) ,
1018
+ data : None ,
1019
+ } )
1020
+ }
1011
1021
}
1012
1022
AnnotationKind :: HasImpls { position : file_position, data } => {
1013
1023
let line_index = snap. file_line_index ( file_position. file_id ) ?;
You can’t perform that action at this time.
0 commit comments