diff options
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/hover.rs | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index 5aacb4c14..1c3dfd491 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs | |||
@@ -1357,6 +1357,36 @@ fn foo() { let bar = Ba<|>r; } | |||
1357 | ); | 1357 | ); |
1358 | } | 1358 | } |
1359 | 1359 | ||
1360 | #[ignore = "path based links currently only support documentation on ModuleDef items"] | ||
1361 | #[test] | ||
1362 | fn test_hover_path_link_field() { | ||
1363 | check( | ||
1364 | r" | ||
1365 | //- /lib.rs | ||
1366 | pub struct Foo; | ||
1367 | pub struct Bar { | ||
1368 | /// [Foo](struct.Foo.html) | ||
1369 | fie<|>ld: () | ||
1370 | } | ||
1371 | ", | ||
1372 | expect![[r#" | ||
1373 | *field* | ||
1374 | |||
1375 | ```rust | ||
1376 | test::Bar | ||
1377 | ``` | ||
1378 | |||
1379 | ```rust | ||
1380 | field: () | ||
1381 | ``` | ||
1382 | |||
1383 | --- | ||
1384 | |||
1385 | [Foo](https://docs.rs/test/*/test/struct.Foo.html) | ||
1386 | "#]], | ||
1387 | ); | ||
1388 | } | ||
1389 | |||
1360 | #[test] | 1390 | #[test] |
1361 | fn test_hover_intra_link() { | 1391 | fn test_hover_intra_link() { |
1362 | check( | 1392 | check( |
@@ -1387,6 +1417,38 @@ fn foo() { let bar = Ba<|>r; } | |||
1387 | } | 1417 | } |
1388 | 1418 | ||
1389 | #[test] | 1419 | #[test] |
1420 | fn test_hover_intra_link_html_root_url() { | ||
1421 | check( | ||
1422 | r#" | ||
1423 | //- /lib.rs | ||
1424 | |||
1425 | #![doc(arbitrary_attribute = "test", html_root_url = "https:/example.com", arbitrary_attribute2)] | ||
1426 | |||
1427 | pub mod foo { | ||
1428 | pub struct Foo; | ||
1429 | } | ||
1430 | /// [Foo](foo::Foo) | ||
1431 | pub struct B<|>ar | ||
1432 | "#, | ||
1433 | expect![[r#" | ||
1434 | *Bar* | ||
1435 | |||
1436 | ```rust | ||
1437 | test | ||
1438 | ``` | ||
1439 | |||
1440 | ```rust | ||
1441 | pub struct Bar | ||
1442 | ``` | ||
1443 | |||
1444 | --- | ||
1445 | |||
1446 | [Foo](https://example.com/test/foo/struct.Foo.html) | ||
1447 | "#]], | ||
1448 | ); | ||
1449 | } | ||
1450 | |||
1451 | #[test] | ||
1390 | fn test_hover_intra_link_shortlink() { | 1452 | fn test_hover_intra_link_shortlink() { |
1391 | check( | 1453 | check( |
1392 | r" | 1454 | r" |