@@ -1342,7 +1342,7 @@ pub(crate) fn code_action(
13421342pub ( crate ) fn runnable (
13431343 snap : & GlobalStateSnapshot ,
13441344 runnable : Runnable ,
1345- ) -> Cancellable < lsp_ext:: Runnable > {
1345+ ) -> Cancellable < Option < lsp_ext:: Runnable > > {
13461346 let config = snap. config . runnables ( ) ;
13471347 let target_spec = TargetSpec :: for_file ( snap, runnable. nav . file_id ) ?;
13481348
@@ -1357,7 +1357,7 @@ pub(crate) fn runnable(
13571357 let label = runnable. label ( Some ( target) ) ;
13581358 let location = location_link ( snap, None , runnable. nav ) ?;
13591359
1360- Ok ( lsp_ext:: Runnable {
1360+ Ok ( Some ( lsp_ext:: Runnable {
13611361 label,
13621362 location : Some ( location) ,
13631363 kind : lsp_ext:: RunnableKind :: Cargo ,
@@ -1369,15 +1369,15 @@ pub(crate) fn runnable(
13691369 executable_args,
13701370 expect_test : None ,
13711371 } ) ,
1372- } )
1372+ } ) )
13731373 }
13741374 None => {
13751375 let ( cargo_args, executable_args) =
13761376 CargoTargetSpec :: runnable_args ( snap, None , & runnable. kind , & runnable. cfg ) ;
13771377 let label = runnable. label ( None ) ;
13781378 let location = location_link ( snap, None , runnable. nav ) ?;
13791379
1380- Ok ( lsp_ext:: Runnable {
1380+ Ok ( Some ( lsp_ext:: Runnable {
13811381 label,
13821382 location : Some ( location) ,
13831383 kind : lsp_ext:: RunnableKind :: Cargo ,
@@ -1389,7 +1389,7 @@ pub(crate) fn runnable(
13891389 executable_args,
13901390 expect_test : None ,
13911391 } ) ,
1392- } )
1392+ } ) )
13931393 }
13941394 }
13951395}
@@ -1415,34 +1415,36 @@ pub(crate) fn code_lens(
14151415 } ;
14161416 let r = runnable ( snap, run) ?;
14171417
1418- let has_root = match & r. args {
1419- lsp_ext:: RunnableArgs :: Cargo ( c) => c. workspace_root . is_some ( ) ,
1420- } ;
1418+ if let Some ( r) = r {
1419+ let has_root = match & r. args {
1420+ lsp_ext:: RunnableArgs :: Cargo ( c) => c. workspace_root . is_some ( ) ,
1421+ } ;
14211422
1422- let lens_config = snap. config . lens ( ) ;
1423- if lens_config. run && client_commands_config. run_single && has_root {
1424- let command = command:: run_single ( & r, & title) ;
1425- acc. push ( lsp_types:: CodeLens {
1426- range : annotation_range,
1427- command : Some ( command) ,
1428- data : None ,
1429- } )
1430- }
1431- if lens_config. debug && can_debug && client_commands_config. debug_single {
1432- let command = command:: debug_single ( & r) ;
1433- acc. push ( lsp_types:: CodeLens {
1434- range : annotation_range,
1435- command : Some ( command) ,
1436- data : None ,
1437- } )
1438- }
1439- if lens_config. interpret {
1440- let command = command:: interpret_single ( & r) ;
1441- acc. push ( lsp_types:: CodeLens {
1442- range : annotation_range,
1443- command : Some ( command) ,
1444- data : None ,
1445- } )
1423+ let lens_config = snap. config . lens ( ) ;
1424+ if lens_config. run && client_commands_config. run_single && has_root {
1425+ let command = command:: run_single ( & r, & title) ;
1426+ acc. push ( lsp_types:: CodeLens {
1427+ range : annotation_range,
1428+ command : Some ( command) ,
1429+ data : None ,
1430+ } )
1431+ }
1432+ if lens_config. debug && can_debug && client_commands_config. debug_single {
1433+ let command = command:: debug_single ( & r) ;
1434+ acc. push ( lsp_types:: CodeLens {
1435+ range : annotation_range,
1436+ command : Some ( command) ,
1437+ data : None ,
1438+ } )
1439+ }
1440+ if lens_config. interpret {
1441+ let command = command:: interpret_single ( & r) ;
1442+ acc. push ( lsp_types:: CodeLens {
1443+ range : annotation_range,
1444+ command : Some ( command) ,
1445+ data : None ,
1446+ } )
1447+ }
14461448 }
14471449 }
14481450 AnnotationKind :: HasImpls { pos, data } => {
@@ -1572,7 +1574,7 @@ pub(crate) fn test_item(
15721574 . file
15731575 . map ( |f| lsp_types:: TextDocumentIdentifier { uri : url ( snap, f) } ) ,
15741576 range : line_index. and_then ( |l| Some ( range ( l, test_item. text_range ?) ) ) ,
1575- runnable : test_item. runnable . and_then ( |r| runnable ( snap, r) . ok ( ) ) ,
1577+ runnable : test_item. runnable . and_then ( |r| runnable ( snap, r) . ok ( ) ) . flatten ( ) ,
15761578 }
15771579}
15781580
0 commit comments