@@ -1342,7 +1342,7 @@ pub(crate) fn code_action(
1342
1342
pub ( crate ) fn runnable (
1343
1343
snap : & GlobalStateSnapshot ,
1344
1344
runnable : Runnable ,
1345
- ) -> Cancellable < lsp_ext:: Runnable > {
1345
+ ) -> Cancellable < Option < lsp_ext:: Runnable > > {
1346
1346
let config = snap. config . runnables ( ) ;
1347
1347
let target_spec = TargetSpec :: for_file ( snap, runnable. nav . file_id ) ?;
1348
1348
@@ -1357,7 +1357,7 @@ pub(crate) fn runnable(
1357
1357
let label = runnable. label ( Some ( target) ) ;
1358
1358
let location = location_link ( snap, None , runnable. nav ) ?;
1359
1359
1360
- Ok ( lsp_ext:: Runnable {
1360
+ Ok ( Some ( lsp_ext:: Runnable {
1361
1361
label,
1362
1362
location : Some ( location) ,
1363
1363
kind : lsp_ext:: RunnableKind :: Cargo ,
@@ -1369,15 +1369,15 @@ pub(crate) fn runnable(
1369
1369
executable_args,
1370
1370
expect_test : None ,
1371
1371
} ) ,
1372
- } )
1372
+ } ) )
1373
1373
}
1374
1374
None => {
1375
1375
let ( cargo_args, executable_args) =
1376
1376
CargoTargetSpec :: runnable_args ( snap, None , & runnable. kind , & runnable. cfg ) ;
1377
1377
let label = runnable. label ( None ) ;
1378
1378
let location = location_link ( snap, None , runnable. nav ) ?;
1379
1379
1380
- Ok ( lsp_ext:: Runnable {
1380
+ Ok ( Some ( lsp_ext:: Runnable {
1381
1381
label,
1382
1382
location : Some ( location) ,
1383
1383
kind : lsp_ext:: RunnableKind :: Cargo ,
@@ -1389,7 +1389,7 @@ pub(crate) fn runnable(
1389
1389
executable_args,
1390
1390
expect_test : None ,
1391
1391
} ) ,
1392
- } )
1392
+ } ) )
1393
1393
}
1394
1394
}
1395
1395
}
@@ -1415,34 +1415,36 @@ pub(crate) fn code_lens(
1415
1415
} ;
1416
1416
let r = runnable ( snap, run) ?;
1417
1417
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
+ } ;
1421
1422
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
+ }
1446
1448
}
1447
1449
}
1448
1450
AnnotationKind :: HasImpls { pos, data } => {
@@ -1572,7 +1574,7 @@ pub(crate) fn test_item(
1572
1574
. file
1573
1575
. map ( |f| lsp_types:: TextDocumentIdentifier { uri : url ( snap, f) } ) ,
1574
1576
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 ( ) ,
1576
1578
}
1577
1579
}
1578
1580
0 commit comments