@@ -1345,7 +1345,7 @@ pub(crate) fn code_action(
1345
1345
pub ( crate ) fn runnable (
1346
1346
snap : & GlobalStateSnapshot ,
1347
1347
runnable : Runnable ,
1348
- ) -> Cancellable < lsp_ext:: Runnable > {
1348
+ ) -> Cancellable < Option < lsp_ext:: Runnable > > {
1349
1349
let config = snap. config . runnables ( ) ;
1350
1350
let target_spec = TargetSpec :: for_file ( snap, runnable. nav . file_id ) ?;
1351
1351
@@ -1360,7 +1360,7 @@ pub(crate) fn runnable(
1360
1360
let label = runnable. label ( Some ( target) ) ;
1361
1361
let location = location_link ( snap, None , runnable. nav ) ?;
1362
1362
1363
- Ok ( lsp_ext:: Runnable {
1363
+ Ok ( Some ( lsp_ext:: Runnable {
1364
1364
label,
1365
1365
location : Some ( location) ,
1366
1366
kind : lsp_ext:: RunnableKind :: Cargo ,
@@ -1372,15 +1372,15 @@ pub(crate) fn runnable(
1372
1372
executable_args,
1373
1373
expect_test : None ,
1374
1374
} ) ,
1375
- } )
1375
+ } ) )
1376
1376
}
1377
1377
None => {
1378
1378
let ( cargo_args, executable_args) =
1379
1379
CargoTargetSpec :: runnable_args ( snap, None , & runnable. kind , & runnable. cfg ) ;
1380
1380
let label = runnable. label ( None ) ;
1381
1381
let location = location_link ( snap, None , runnable. nav ) ?;
1382
1382
1383
- Ok ( lsp_ext:: Runnable {
1383
+ Ok ( Some ( lsp_ext:: Runnable {
1384
1384
label,
1385
1385
location : Some ( location) ,
1386
1386
kind : lsp_ext:: RunnableKind :: Cargo ,
@@ -1392,7 +1392,7 @@ pub(crate) fn runnable(
1392
1392
executable_args,
1393
1393
expect_test : None ,
1394
1394
} ) ,
1395
- } )
1395
+ } ) )
1396
1396
}
1397
1397
}
1398
1398
}
@@ -1418,34 +1418,36 @@ pub(crate) fn code_lens(
1418
1418
} ;
1419
1419
let r = runnable ( snap, run) ?;
1420
1420
1421
- let has_root = match & r. args {
1422
- lsp_ext:: RunnableArgs :: Cargo ( c) => c. workspace_root . is_some ( ) ,
1423
- } ;
1421
+ if let Some ( r) = r {
1422
+ let has_root = match & r. args {
1423
+ lsp_ext:: RunnableArgs :: Cargo ( c) => c. workspace_root . is_some ( ) ,
1424
+ } ;
1424
1425
1425
- let lens_config = snap. config . lens ( ) ;
1426
- if lens_config. run && client_commands_config. run_single && has_root {
1427
- let command = command:: run_single ( & r, & title) ;
1428
- acc. push ( lsp_types:: CodeLens {
1429
- range : annotation_range,
1430
- command : Some ( command) ,
1431
- data : None ,
1432
- } )
1433
- }
1434
- if lens_config. debug && can_debug && client_commands_config. debug_single {
1435
- let command = command:: debug_single ( & r) ;
1436
- acc. push ( lsp_types:: CodeLens {
1437
- range : annotation_range,
1438
- command : Some ( command) ,
1439
- data : None ,
1440
- } )
1441
- }
1442
- if lens_config. interpret {
1443
- let command = command:: interpret_single ( & r) ;
1444
- acc. push ( lsp_types:: CodeLens {
1445
- range : annotation_range,
1446
- command : Some ( command) ,
1447
- data : None ,
1448
- } )
1426
+ let lens_config = snap. config . lens ( ) ;
1427
+ if lens_config. run && client_commands_config. run_single && has_root {
1428
+ let command = command:: run_single ( & r, & title) ;
1429
+ acc. push ( lsp_types:: CodeLens {
1430
+ range : annotation_range,
1431
+ command : Some ( command) ,
1432
+ data : None ,
1433
+ } )
1434
+ }
1435
+ if lens_config. debug && can_debug && client_commands_config. debug_single {
1436
+ let command = command:: debug_single ( & r) ;
1437
+ acc. push ( lsp_types:: CodeLens {
1438
+ range : annotation_range,
1439
+ command : Some ( command) ,
1440
+ data : None ,
1441
+ } )
1442
+ }
1443
+ if lens_config. interpret {
1444
+ let command = command:: interpret_single ( & r) ;
1445
+ acc. push ( lsp_types:: CodeLens {
1446
+ range : annotation_range,
1447
+ command : Some ( command) ,
1448
+ data : None ,
1449
+ } )
1450
+ }
1449
1451
}
1450
1452
}
1451
1453
AnnotationKind :: HasImpls { pos, data } => {
@@ -1575,7 +1577,7 @@ pub(crate) fn test_item(
1575
1577
. file
1576
1578
. map ( |f| lsp_types:: TextDocumentIdentifier { uri : url ( snap, f) } ) ,
1577
1579
range : line_index. and_then ( |l| Some ( range ( l, test_item. text_range ?) ) ) ,
1578
- runnable : test_item. runnable . and_then ( |r| runnable ( snap, r) . ok ( ) ) ,
1580
+ runnable : test_item. runnable . and_then ( |r| runnable ( snap, r) . ok ( ) ) . flatten ( ) ,
1579
1581
} )
1580
1582
}
1581
1583
0 commit comments