aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src')
-rw-r--r--crates/ide/src/display/navigation_target.rs53
-rw-r--r--crates/ide/src/hover.rs512
-rw-r--r--crates/ide/src/runnables.rs201
3 files changed, 169 insertions, 597 deletions
diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs
index 9b9295955..cbdd4ecc2 100644
--- a/crates/ide/src/display/navigation_target.rs
+++ b/crates/ide/src/display/navigation_target.rs
@@ -1,5 +1,7 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2 2
3use std::fmt;
4
3use either::Either; 5use either::Either;
4use hir::{AssocItem, Documentation, FieldSource, HasAttrs, HasSource, InFile, ModuleSource}; 6use hir::{AssocItem, Documentation, FieldSource, HasAttrs, HasSource, InFile, ModuleSource};
5use ide_db::{ 7use ide_db::{
@@ -42,7 +44,7 @@ pub enum SymbolKind {
42/// 44///
43/// Typically, a `NavigationTarget` corresponds to some element in the source 45/// Typically, a `NavigationTarget` corresponds to some element in the source
44/// code, like a function or a struct, but this is not strictly required. 46/// code, like a function or a struct, but this is not strictly required.
45#[derive(Debug, Clone, PartialEq, Eq, Hash)] 47#[derive(Clone, PartialEq, Eq, Hash)]
46pub struct NavigationTarget { 48pub struct NavigationTarget {
47 pub file_id: FileId, 49 pub file_id: FileId,
48 /// Range which encompasses the whole element. 50 /// Range which encompasses the whole element.
@@ -68,6 +70,24 @@ pub struct NavigationTarget {
68 pub docs: Option<Documentation>, 70 pub docs: Option<Documentation>,
69} 71}
70 72
73impl fmt::Debug for NavigationTarget {
74 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
75 let mut f = f.debug_struct("NavigationTarget");
76 macro_rules! opt {
77 ($($name:ident)*) => {$(
78 if let Some(it) = &self.$name {
79 f.field(stringify!($name), it);
80 }
81 )*}
82 }
83 f.field("file_id", &self.file_id).field("full_range", &self.full_range);
84 opt!(focus_range);
85 f.field("name", &self.name);
86 opt!(kind container_name description docs);
87 f.finish()
88 }
89}
90
71pub(crate) trait ToNav { 91pub(crate) trait ToNav {
72 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget; 92 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget;
73} 93}
@@ -487,38 +507,21 @@ fn foo() { enum FooInner { } }
487 0, 507 0,
488 ), 508 ),
489 full_range: 0..17, 509 full_range: 0..17,
490 focus_range: Some( 510 focus_range: 5..13,
491 5..13,
492 ),
493 name: "FooInner", 511 name: "FooInner",
494 kind: Some( 512 kind: Enum,
495 Enum, 513 description: "enum FooInner",
496 ),
497 container_name: None,
498 description: Some(
499 "enum FooInner",
500 ),
501 docs: None,
502 }, 514 },
503 NavigationTarget { 515 NavigationTarget {
504 file_id: FileId( 516 file_id: FileId(
505 0, 517 0,
506 ), 518 ),
507 full_range: 29..46, 519 full_range: 29..46,
508 focus_range: Some( 520 focus_range: 34..42,
509 34..42,
510 ),
511 name: "FooInner", 521 name: "FooInner",
512 kind: Some( 522 kind: Enum,
513 Enum, 523 container_name: "foo",
514 ), 524 description: "enum FooInner",
515 container_name: Some(
516 "foo",
517 ),
518 description: Some(
519 "enum FooInner",
520 ),
521 docs: None,
522 }, 525 },
523 ] 526 ]
524 "#]] 527 "#]]
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index 413b1526a..b06fa5f15 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -2187,16 +2187,9 @@ fn foo_<|>test() {}
2187 0, 2187 0,
2188 ), 2188 ),
2189 full_range: 0..24, 2189 full_range: 0..24,
2190 focus_range: Some( 2190 focus_range: 11..19,
2191 11..19,
2192 ),
2193 name: "foo_test", 2191 name: "foo_test",
2194 kind: Some( 2192 kind: Function,
2195 Function,
2196 ),
2197 container_name: None,
2198 description: None,
2199 docs: None,
2200 }, 2193 },
2201 kind: Test { 2194 kind: Test {
2202 test_id: Path( 2195 test_id: Path(
@@ -2232,16 +2225,9 @@ mod tests<|> {
2232 0, 2225 0,
2233 ), 2226 ),
2234 full_range: 0..46, 2227 full_range: 0..46,
2235 focus_range: Some( 2228 focus_range: 4..9,
2236 4..9,
2237 ),
2238 name: "tests", 2229 name: "tests",
2239 kind: Some( 2230 kind: Module,
2240 Module,
2241 ),
2242 container_name: None,
2243 description: None,
2244 docs: None,
2245 }, 2231 },
2246 kind: TestMod { 2232 kind: TestMod {
2247 path: "tests", 2233 path: "tests",
@@ -2273,18 +2259,10 @@ fn main() { let s<|>t = S{ f1:0 }; }
2273 0, 2259 0,
2274 ), 2260 ),
2275 full_range: 0..19, 2261 full_range: 0..19,
2276 focus_range: Some( 2262 focus_range: 7..8,
2277 7..8,
2278 ),
2279 name: "S", 2263 name: "S",
2280 kind: Some( 2264 kind: Struct,
2281 Struct, 2265 description: "struct S",
2282 ),
2283 container_name: None,
2284 description: Some(
2285 "struct S",
2286 ),
2287 docs: None,
2288 }, 2266 },
2289 }, 2267 },
2290 ], 2268 ],
@@ -2314,18 +2292,10 @@ fn main() { let s<|>t = S{ f1:Arg(0) }; }
2314 0, 2292 0,
2315 ), 2293 ),
2316 full_range: 17..37, 2294 full_range: 17..37,
2317 focus_range: Some( 2295 focus_range: 24..25,
2318 24..25,
2319 ),
2320 name: "S", 2296 name: "S",
2321 kind: Some( 2297 kind: Struct,
2322 Struct, 2298 description: "struct S",
2323 ),
2324 container_name: None,
2325 description: Some(
2326 "struct S",
2327 ),
2328 docs: None,
2329 }, 2299 },
2330 }, 2300 },
2331 HoverGotoTypeData { 2301 HoverGotoTypeData {
@@ -2335,18 +2305,10 @@ fn main() { let s<|>t = S{ f1:Arg(0) }; }
2335 0, 2305 0,
2336 ), 2306 ),
2337 full_range: 0..16, 2307 full_range: 0..16,
2338 focus_range: Some( 2308 focus_range: 7..10,
2339 7..10,
2340 ),
2341 name: "Arg", 2309 name: "Arg",
2342 kind: Some( 2310 kind: Struct,
2343 Struct, 2311 description: "struct Arg",
2344 ),
2345 container_name: None,
2346 description: Some(
2347 "struct Arg",
2348 ),
2349 docs: None,
2350 }, 2312 },
2351 }, 2313 },
2352 ], 2314 ],
@@ -2376,18 +2338,10 @@ fn main() { let s<|>t = S{ f1: S{ f1: Arg(0) } }; }
2376 0, 2338 0,
2377 ), 2339 ),
2378 full_range: 17..37, 2340 full_range: 17..37,
2379 focus_range: Some( 2341 focus_range: 24..25,
2380 24..25,
2381 ),
2382 name: "S", 2342 name: "S",
2383 kind: Some( 2343 kind: Struct,
2384 Struct, 2344 description: "struct S",
2385 ),
2386 container_name: None,
2387 description: Some(
2388 "struct S",
2389 ),
2390 docs: None,
2391 }, 2345 },
2392 }, 2346 },
2393 HoverGotoTypeData { 2347 HoverGotoTypeData {
@@ -2397,18 +2351,10 @@ fn main() { let s<|>t = S{ f1: S{ f1: Arg(0) } }; }
2397 0, 2351 0,
2398 ), 2352 ),
2399 full_range: 0..16, 2353 full_range: 0..16,
2400 focus_range: Some( 2354 focus_range: 7..10,
2401 7..10,
2402 ),
2403 name: "Arg", 2355 name: "Arg",
2404 kind: Some( 2356 kind: Struct,
2405 Struct, 2357 description: "struct Arg",
2406 ),
2407 container_name: None,
2408 description: Some(
2409 "struct Arg",
2410 ),
2411 docs: None,
2412 }, 2358 },
2413 }, 2359 },
2414 ], 2360 ],
@@ -2441,18 +2387,10 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); }
2441 0, 2387 0,
2442 ), 2388 ),
2443 full_range: 0..14, 2389 full_range: 0..14,
2444 focus_range: Some( 2390 focus_range: 7..8,
2445 7..8,
2446 ),
2447 name: "A", 2391 name: "A",
2448 kind: Some( 2392 kind: Struct,
2449 Struct, 2393 description: "struct A",
2450 ),
2451 container_name: None,
2452 description: Some(
2453 "struct A",
2454 ),
2455 docs: None,
2456 }, 2394 },
2457 }, 2395 },
2458 HoverGotoTypeData { 2396 HoverGotoTypeData {
@@ -2462,18 +2400,10 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); }
2462 0, 2400 0,
2463 ), 2401 ),
2464 full_range: 15..29, 2402 full_range: 15..29,
2465 focus_range: Some( 2403 focus_range: 22..23,
2466 22..23,
2467 ),
2468 name: "B", 2404 name: "B",
2469 kind: Some( 2405 kind: Struct,
2470 Struct, 2406 description: "struct B",
2471 ),
2472 container_name: None,
2473 description: Some(
2474 "struct B",
2475 ),
2476 docs: None,
2477 }, 2407 },
2478 }, 2408 },
2479 HoverGotoTypeData { 2409 HoverGotoTypeData {
@@ -2483,18 +2413,10 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); }
2483 0, 2413 0,
2484 ), 2414 ),
2485 full_range: 42..60, 2415 full_range: 42..60,
2486 focus_range: Some( 2416 focus_range: 53..54,
2487 53..54,
2488 ),
2489 name: "C", 2417 name: "C",
2490 kind: Some( 2418 kind: Struct,
2491 Struct, 2419 description: "pub struct C",
2492 ),
2493 container_name: None,
2494 description: Some(
2495 "pub struct C",
2496 ),
2497 docs: None,
2498 }, 2420 },
2499 }, 2421 },
2500 ], 2422 ],
@@ -2524,18 +2446,10 @@ fn main() { let s<|>t = foo(); }
2524 0, 2446 0,
2525 ), 2447 ),
2526 full_range: 0..12, 2448 full_range: 0..12,
2527 focus_range: Some( 2449 focus_range: 6..9,
2528 6..9,
2529 ),
2530 name: "Foo", 2450 name: "Foo",
2531 kind: Some( 2451 kind: Trait,
2532 Trait, 2452 description: "trait Foo",
2533 ),
2534 container_name: None,
2535 description: Some(
2536 "trait Foo",
2537 ),
2538 docs: None,
2539 }, 2453 },
2540 }, 2454 },
2541 ], 2455 ],
@@ -2566,18 +2480,10 @@ fn main() { let s<|>t = foo(); }
2566 0, 2480 0,
2567 ), 2481 ),
2568 full_range: 0..15, 2482 full_range: 0..15,
2569 focus_range: Some( 2483 focus_range: 6..9,
2570 6..9,
2571 ),
2572 name: "Foo", 2484 name: "Foo",
2573 kind: Some( 2485 kind: Trait,
2574 Trait, 2486 description: "trait Foo",
2575 ),
2576 container_name: None,
2577 description: Some(
2578 "trait Foo",
2579 ),
2580 docs: None,
2581 }, 2487 },
2582 }, 2488 },
2583 HoverGotoTypeData { 2489 HoverGotoTypeData {
@@ -2587,18 +2493,10 @@ fn main() { let s<|>t = foo(); }
2587 0, 2493 0,
2588 ), 2494 ),
2589 full_range: 16..25, 2495 full_range: 16..25,
2590 focus_range: Some( 2496 focus_range: 23..24,
2591 23..24,
2592 ),
2593 name: "S", 2497 name: "S",
2594 kind: Some( 2498 kind: Struct,
2595 Struct, 2499 description: "struct S",
2596 ),
2597 container_name: None,
2598 description: Some(
2599 "struct S",
2600 ),
2601 docs: None,
2602 }, 2500 },
2603 }, 2501 },
2604 ], 2502 ],
@@ -2629,18 +2527,10 @@ fn main() { let s<|>t = foo(); }
2629 0, 2527 0,
2630 ), 2528 ),
2631 full_range: 0..12, 2529 full_range: 0..12,
2632 focus_range: Some( 2530 focus_range: 6..9,
2633 6..9,
2634 ),
2635 name: "Foo", 2531 name: "Foo",
2636 kind: Some( 2532 kind: Trait,
2637 Trait, 2533 description: "trait Foo",
2638 ),
2639 container_name: None,
2640 description: Some(
2641 "trait Foo",
2642 ),
2643 docs: None,
2644 }, 2534 },
2645 }, 2535 },
2646 HoverGotoTypeData { 2536 HoverGotoTypeData {
@@ -2650,18 +2540,10 @@ fn main() { let s<|>t = foo(); }
2650 0, 2540 0,
2651 ), 2541 ),
2652 full_range: 13..25, 2542 full_range: 13..25,
2653 focus_range: Some( 2543 focus_range: 19..22,
2654 19..22,
2655 ),
2656 name: "Bar", 2544 name: "Bar",
2657 kind: Some( 2545 kind: Trait,
2658 Trait, 2546 description: "trait Bar",
2659 ),
2660 container_name: None,
2661 description: Some(
2662 "trait Bar",
2663 ),
2664 docs: None,
2665 }, 2547 },
2666 }, 2548 },
2667 ], 2549 ],
@@ -2695,18 +2577,10 @@ fn main() { let s<|>t = foo(); }
2695 0, 2577 0,
2696 ), 2578 ),
2697 full_range: 0..15, 2579 full_range: 0..15,
2698 focus_range: Some( 2580 focus_range: 6..9,
2699 6..9,
2700 ),
2701 name: "Foo", 2581 name: "Foo",
2702 kind: Some( 2582 kind: Trait,
2703 Trait, 2583 description: "trait Foo",
2704 ),
2705 container_name: None,
2706 description: Some(
2707 "trait Foo",
2708 ),
2709 docs: None,
2710 }, 2584 },
2711 }, 2585 },
2712 HoverGotoTypeData { 2586 HoverGotoTypeData {
@@ -2716,18 +2590,10 @@ fn main() { let s<|>t = foo(); }
2716 0, 2590 0,
2717 ), 2591 ),
2718 full_range: 16..31, 2592 full_range: 16..31,
2719 focus_range: Some( 2593 focus_range: 22..25,
2720 22..25,
2721 ),
2722 name: "Bar", 2594 name: "Bar",
2723 kind: Some( 2595 kind: Trait,
2724 Trait, 2596 description: "trait Bar",
2725 ),
2726 container_name: None,
2727 description: Some(
2728 "trait Bar",
2729 ),
2730 docs: None,
2731 }, 2597 },
2732 }, 2598 },
2733 HoverGotoTypeData { 2599 HoverGotoTypeData {
@@ -2737,18 +2603,10 @@ fn main() { let s<|>t = foo(); }
2737 0, 2603 0,
2738 ), 2604 ),
2739 full_range: 32..44, 2605 full_range: 32..44,
2740 focus_range: Some( 2606 focus_range: 39..41,
2741 39..41,
2742 ),
2743 name: "S1", 2607 name: "S1",
2744 kind: Some( 2608 kind: Struct,
2745 Struct, 2609 description: "struct S1",
2746 ),
2747 container_name: None,
2748 description: Some(
2749 "struct S1",
2750 ),
2751 docs: None,
2752 }, 2610 },
2753 }, 2611 },
2754 HoverGotoTypeData { 2612 HoverGotoTypeData {
@@ -2758,18 +2616,10 @@ fn main() { let s<|>t = foo(); }
2758 0, 2616 0,
2759 ), 2617 ),
2760 full_range: 45..57, 2618 full_range: 45..57,
2761 focus_range: Some( 2619 focus_range: 52..54,
2762 52..54,
2763 ),
2764 name: "S2", 2620 name: "S2",
2765 kind: Some( 2621 kind: Struct,
2766 Struct, 2622 description: "struct S2",
2767 ),
2768 container_name: None,
2769 description: Some(
2770 "struct S2",
2771 ),
2772 docs: None,
2773 }, 2623 },
2774 }, 2624 },
2775 ], 2625 ],
@@ -2797,18 +2647,10 @@ fn foo(ar<|>g: &impl Foo) {}
2797 0, 2647 0,
2798 ), 2648 ),
2799 full_range: 0..12, 2649 full_range: 0..12,
2800 focus_range: Some( 2650 focus_range: 6..9,
2801 6..9,
2802 ),
2803 name: "Foo", 2651 name: "Foo",
2804 kind: Some( 2652 kind: Trait,
2805 Trait, 2653 description: "trait Foo",
2806 ),
2807 container_name: None,
2808 description: Some(
2809 "trait Foo",
2810 ),
2811 docs: None,
2812 }, 2654 },
2813 }, 2655 },
2814 ], 2656 ],
@@ -2839,18 +2681,10 @@ fn foo(ar<|>g: &impl Foo + Bar<S>) {}
2839 0, 2681 0,
2840 ), 2682 ),
2841 full_range: 0..12, 2683 full_range: 0..12,
2842 focus_range: Some( 2684 focus_range: 6..9,
2843 6..9,
2844 ),
2845 name: "Foo", 2685 name: "Foo",
2846 kind: Some( 2686 kind: Trait,
2847 Trait, 2687 description: "trait Foo",
2848 ),
2849 container_name: None,
2850 description: Some(
2851 "trait Foo",
2852 ),
2853 docs: None,
2854 }, 2688 },
2855 }, 2689 },
2856 HoverGotoTypeData { 2690 HoverGotoTypeData {
@@ -2860,18 +2694,10 @@ fn foo(ar<|>g: &impl Foo + Bar<S>) {}
2860 0, 2694 0,
2861 ), 2695 ),
2862 full_range: 13..28, 2696 full_range: 13..28,
2863 focus_range: Some( 2697 focus_range: 19..22,
2864 19..22,
2865 ),
2866 name: "Bar", 2698 name: "Bar",
2867 kind: Some( 2699 kind: Trait,
2868 Trait, 2700 description: "trait Bar",
2869 ),
2870 container_name: None,
2871 description: Some(
2872 "trait Bar",
2873 ),
2874 docs: None,
2875 }, 2701 },
2876 }, 2702 },
2877 HoverGotoTypeData { 2703 HoverGotoTypeData {
@@ -2881,18 +2707,10 @@ fn foo(ar<|>g: &impl Foo + Bar<S>) {}
2881 0, 2707 0,
2882 ), 2708 ),
2883 full_range: 29..39, 2709 full_range: 29..39,
2884 focus_range: Some( 2710 focus_range: 36..37,
2885 36..37,
2886 ),
2887 name: "S", 2711 name: "S",
2888 kind: Some( 2712 kind: Struct,
2889 Struct, 2713 description: "struct S",
2890 ),
2891 container_name: None,
2892 description: Some(
2893 "struct S",
2894 ),
2895 docs: None,
2896 }, 2714 },
2897 }, 2715 },
2898 ], 2716 ],
@@ -2928,18 +2746,10 @@ mod future {
2928 0, 2746 0,
2929 ), 2747 ),
2930 full_range: 101..163, 2748 full_range: 101..163,
2931 focus_range: Some( 2749 focus_range: 140..146,
2932 140..146,
2933 ),
2934 name: "Future", 2750 name: "Future",
2935 kind: Some( 2751 kind: Trait,
2936 Trait, 2752 description: "pub trait Future",
2937 ),
2938 container_name: None,
2939 description: Some(
2940 "pub trait Future",
2941 ),
2942 docs: None,
2943 }, 2753 },
2944 }, 2754 },
2945 HoverGotoTypeData { 2755 HoverGotoTypeData {
@@ -2949,18 +2759,10 @@ mod future {
2949 0, 2759 0,
2950 ), 2760 ),
2951 full_range: 0..9, 2761 full_range: 0..9,
2952 focus_range: Some( 2762 focus_range: 7..8,
2953 7..8,
2954 ),
2955 name: "S", 2763 name: "S",
2956 kind: Some( 2764 kind: Struct,
2957 Struct, 2765 description: "struct S",
2958 ),
2959 container_name: None,
2960 description: Some(
2961 "struct S",
2962 ),
2963 docs: None,
2964 }, 2766 },
2965 }, 2767 },
2966 ], 2768 ],
@@ -2989,18 +2791,10 @@ fn foo(ar<|>g: &impl Foo<S>) {}
2989 0, 2791 0,
2990 ), 2792 ),
2991 full_range: 0..15, 2793 full_range: 0..15,
2992 focus_range: Some( 2794 focus_range: 6..9,
2993 6..9,
2994 ),
2995 name: "Foo", 2795 name: "Foo",
2996 kind: Some( 2796 kind: Trait,
2997 Trait, 2797 description: "trait Foo",
2998 ),
2999 container_name: None,
3000 description: Some(
3001 "trait Foo",
3002 ),
3003 docs: None,
3004 }, 2798 },
3005 }, 2799 },
3006 HoverGotoTypeData { 2800 HoverGotoTypeData {
@@ -3010,18 +2804,10 @@ fn foo(ar<|>g: &impl Foo<S>) {}
3010 0, 2804 0,
3011 ), 2805 ),
3012 full_range: 16..27, 2806 full_range: 16..27,
3013 focus_range: Some( 2807 focus_range: 23..24,
3014 23..24,
3015 ),
3016 name: "S", 2808 name: "S",
3017 kind: Some( 2809 kind: Struct,
3018 Struct, 2810 description: "struct S",
3019 ),
3020 container_name: None,
3021 description: Some(
3022 "struct S",
3023 ),
3024 docs: None,
3025 }, 2811 },
3026 }, 2812 },
3027 ], 2813 ],
@@ -3055,18 +2841,10 @@ fn main() { let s<|>t = foo(); }
3055 0, 2841 0,
3056 ), 2842 ),
3057 full_range: 42..55, 2843 full_range: 42..55,
3058 focus_range: Some( 2844 focus_range: 49..50,
3059 49..50,
3060 ),
3061 name: "B", 2845 name: "B",
3062 kind: Some( 2846 kind: Struct,
3063 Struct, 2847 description: "struct B",
3064 ),
3065 container_name: None,
3066 description: Some(
3067 "struct B",
3068 ),
3069 docs: None,
3070 }, 2848 },
3071 }, 2849 },
3072 HoverGotoTypeData { 2850 HoverGotoTypeData {
@@ -3076,18 +2854,10 @@ fn main() { let s<|>t = foo(); }
3076 0, 2854 0,
3077 ), 2855 ),
3078 full_range: 0..12, 2856 full_range: 0..12,
3079 focus_range: Some( 2857 focus_range: 6..9,
3080 6..9,
3081 ),
3082 name: "Foo", 2858 name: "Foo",
3083 kind: Some( 2859 kind: Trait,
3084 Trait, 2860 description: "trait Foo",
3085 ),
3086 container_name: None,
3087 description: Some(
3088 "trait Foo",
3089 ),
3090 docs: None,
3091 }, 2861 },
3092 }, 2862 },
3093 ], 2863 ],
@@ -3115,18 +2885,10 @@ fn foo(ar<|>g: &dyn Foo) {}
3115 0, 2885 0,
3116 ), 2886 ),
3117 full_range: 0..12, 2887 full_range: 0..12,
3118 focus_range: Some( 2888 focus_range: 6..9,
3119 6..9,
3120 ),
3121 name: "Foo", 2889 name: "Foo",
3122 kind: Some( 2890 kind: Trait,
3123 Trait, 2891 description: "trait Foo",
3124 ),
3125 container_name: None,
3126 description: Some(
3127 "trait Foo",
3128 ),
3129 docs: None,
3130 }, 2892 },
3131 }, 2893 },
3132 ], 2894 ],
@@ -3155,18 +2917,10 @@ fn foo(ar<|>g: &dyn Foo<S>) {}
3155 0, 2917 0,
3156 ), 2918 ),
3157 full_range: 0..15, 2919 full_range: 0..15,
3158 focus_range: Some( 2920 focus_range: 6..9,
3159 6..9,
3160 ),
3161 name: "Foo", 2921 name: "Foo",
3162 kind: Some( 2922 kind: Trait,
3163 Trait, 2923 description: "trait Foo",
3164 ),
3165 container_name: None,
3166 description: Some(
3167 "trait Foo",
3168 ),
3169 docs: None,
3170 }, 2924 },
3171 }, 2925 },
3172 HoverGotoTypeData { 2926 HoverGotoTypeData {
@@ -3176,18 +2930,10 @@ fn foo(ar<|>g: &dyn Foo<S>) {}
3176 0, 2930 0,
3177 ), 2931 ),
3178 full_range: 16..27, 2932 full_range: 16..27,
3179 focus_range: Some( 2933 focus_range: 23..24,
3180 23..24,
3181 ),
3182 name: "S", 2934 name: "S",
3183 kind: Some( 2935 kind: Struct,
3184 Struct, 2936 description: "struct S",
3185 ),
3186 container_name: None,
3187 description: Some(
3188 "struct S",
3189 ),
3190 docs: None,
3191 }, 2937 },
3192 }, 2938 },
3193 ], 2939 ],
@@ -3219,18 +2965,10 @@ fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {}
3219 0, 2965 0,
3220 ), 2966 ),
3221 full_range: 0..21, 2967 full_range: 0..21,
3222 focus_range: Some( 2968 focus_range: 6..15,
3223 6..15,
3224 ),
3225 name: "ImplTrait", 2969 name: "ImplTrait",
3226 kind: Some( 2970 kind: Trait,
3227 Trait, 2971 description: "trait ImplTrait",
3228 ),
3229 container_name: None,
3230 description: Some(
3231 "trait ImplTrait",
3232 ),
3233 docs: None,
3234 }, 2972 },
3235 }, 2973 },
3236 HoverGotoTypeData { 2974 HoverGotoTypeData {
@@ -3240,18 +2978,10 @@ fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {}
3240 0, 2978 0,
3241 ), 2979 ),
3242 full_range: 43..57, 2980 full_range: 43..57,
3243 focus_range: Some( 2981 focus_range: 50..51,
3244 50..51,
3245 ),
3246 name: "B", 2982 name: "B",
3247 kind: Some( 2983 kind: Struct,
3248 Struct, 2984 description: "struct B",
3249 ),
3250 container_name: None,
3251 description: Some(
3252 "struct B",
3253 ),
3254 docs: None,
3255 }, 2985 },
3256 }, 2986 },
3257 HoverGotoTypeData { 2987 HoverGotoTypeData {
@@ -3261,18 +2991,10 @@ fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {}
3261 0, 2991 0,
3262 ), 2992 ),
3263 full_range: 22..42, 2993 full_range: 22..42,
3264 focus_range: Some( 2994 focus_range: 28..36,
3265 28..36,
3266 ),
3267 name: "DynTrait", 2995 name: "DynTrait",
3268 kind: Some( 2996 kind: Trait,
3269 Trait, 2997 description: "trait DynTrait",
3270 ),
3271 container_name: None,
3272 description: Some(
3273 "trait DynTrait",
3274 ),
3275 docs: None,
3276 }, 2998 },
3277 }, 2999 },
3278 HoverGotoTypeData { 3000 HoverGotoTypeData {
@@ -3282,18 +3004,10 @@ fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {}
3282 0, 3004 0,
3283 ), 3005 ),
3284 full_range: 58..69, 3006 full_range: 58..69,
3285 focus_range: Some( 3007 focus_range: 65..66,
3286 65..66,
3287 ),
3288 name: "S", 3008 name: "S",
3289 kind: Some( 3009 kind: Struct,
3290 Struct, 3010 description: "struct S",
3291 ),
3292 container_name: None,
3293 description: Some(
3294 "struct S",
3295 ),
3296 docs: None,
3297 }, 3011 },
3298 }, 3012 },
3299 ], 3013 ],
@@ -3332,18 +3046,10 @@ fn main() { let s<|>t = test().get(); }
3332 0, 3046 0,
3333 ), 3047 ),
3334 full_range: 0..62, 3048 full_range: 0..62,
3335 focus_range: Some( 3049 focus_range: 6..9,
3336 6..9,
3337 ),
3338 name: "Foo", 3050 name: "Foo",
3339 kind: Some( 3051 kind: Trait,
3340 Trait, 3052 description: "trait Foo",
3341 ),
3342 container_name: None,
3343 description: Some(
3344 "trait Foo",
3345 ),
3346 docs: None,
3347 }, 3053 },
3348 }, 3054 },
3349 ], 3055 ],
diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs
index 99f11c295..ff386be80 100644
--- a/crates/ide/src/runnables.rs
+++ b/crates/ide/src/runnables.rs
@@ -352,16 +352,9 @@ fn bench() {}
352 0, 352 0,
353 ), 353 ),
354 full_range: 1..13, 354 full_range: 1..13,
355 focus_range: Some( 355 focus_range: 4..8,
356 4..8,
357 ),
358 name: "main", 356 name: "main",
359 kind: Some( 357 kind: Function,
360 Function,
361 ),
362 container_name: None,
363 description: None,
364 docs: None,
365 }, 358 },
366 kind: Bin, 359 kind: Bin,
367 cfg: None, 360 cfg: None,
@@ -372,16 +365,9 @@ fn bench() {}
372 0, 365 0,
373 ), 366 ),
374 full_range: 15..39, 367 full_range: 15..39,
375 focus_range: Some( 368 focus_range: 26..34,
376 26..34,
377 ),
378 name: "test_foo", 369 name: "test_foo",
379 kind: Some( 370 kind: Function,
380 Function,
381 ),
382 container_name: None,
383 description: None,
384 docs: None,
385 }, 371 },
386 kind: Test { 372 kind: Test {
387 test_id: Path( 373 test_id: Path(
@@ -399,16 +385,9 @@ fn bench() {}
399 0, 385 0,
400 ), 386 ),
401 full_range: 41..75, 387 full_range: 41..75,
402 focus_range: Some( 388 focus_range: 62..70,
403 62..70,
404 ),
405 name: "test_foo", 389 name: "test_foo",
406 kind: Some( 390 kind: Function,
407 Function,
408 ),
409 container_name: None,
410 description: None,
411 docs: None,
412 }, 391 },
413 kind: Test { 392 kind: Test {
414 test_id: Path( 393 test_id: Path(
@@ -426,16 +405,9 @@ fn bench() {}
426 0, 405 0,
427 ), 406 ),
428 full_range: 77..99, 407 full_range: 77..99,
429 focus_range: Some( 408 focus_range: 89..94,
430 89..94,
431 ),
432 name: "bench", 409 name: "bench",
433 kind: Some( 410 kind: Function,
434 Function,
435 ),
436 container_name: None,
437 description: None,
438 docs: None,
439 }, 411 },
440 kind: Bench { 412 kind: Bench {
441 test_id: Path( 413 test_id: Path(
@@ -525,16 +497,9 @@ struct StructWithRunnable(String);
525 0, 497 0,
526 ), 498 ),
527 full_range: 1..13, 499 full_range: 1..13,
528 focus_range: Some( 500 focus_range: 4..8,
529 4..8,
530 ),
531 name: "main", 501 name: "main",
532 kind: Some( 502 kind: Function,
533 Function,
534 ),
535 container_name: None,
536 description: None,
537 docs: None,
538 }, 503 },
539 kind: Bin, 504 kind: Bin,
540 cfg: None, 505 cfg: None,
@@ -545,12 +510,7 @@ struct StructWithRunnable(String);
545 0, 510 0,
546 ), 511 ),
547 full_range: 15..74, 512 full_range: 15..74,
548 focus_range: None,
549 name: "should_have_runnable", 513 name: "should_have_runnable",
550 kind: None,
551 container_name: None,
552 description: None,
553 docs: None,
554 }, 514 },
555 kind: DocTest { 515 kind: DocTest {
556 test_id: Path( 516 test_id: Path(
@@ -565,12 +525,7 @@ struct StructWithRunnable(String);
565 0, 525 0,
566 ), 526 ),
567 full_range: 76..148, 527 full_range: 76..148,
568 focus_range: None,
569 name: "should_have_runnable_1", 528 name: "should_have_runnable_1",
570 kind: None,
571 container_name: None,
572 description: None,
573 docs: None,
574 }, 529 },
575 kind: DocTest { 530 kind: DocTest {
576 test_id: Path( 531 test_id: Path(
@@ -585,12 +540,7 @@ struct StructWithRunnable(String);
585 0, 540 0,
586 ), 541 ),
587 full_range: 150..254, 542 full_range: 150..254,
588 focus_range: None,
589 name: "should_have_runnable_2", 543 name: "should_have_runnable_2",
590 kind: None,
591 container_name: None,
592 description: None,
593 docs: None,
594 }, 544 },
595 kind: DocTest { 545 kind: DocTest {
596 test_id: Path( 546 test_id: Path(
@@ -605,12 +555,7 @@ struct StructWithRunnable(String);
605 0, 555 0,
606 ), 556 ),
607 full_range: 756..821, 557 full_range: 756..821,
608 focus_range: None,
609 name: "StructWithRunnable", 558 name: "StructWithRunnable",
610 kind: None,
611 container_name: None,
612 description: None,
613 docs: None,
614 }, 559 },
615 kind: DocTest { 560 kind: DocTest {
616 test_id: Path( 561 test_id: Path(
@@ -649,16 +594,9 @@ impl Data {
649 0, 594 0,
650 ), 595 ),
651 full_range: 1..13, 596 full_range: 1..13,
652 focus_range: Some( 597 focus_range: 4..8,
653 4..8,
654 ),
655 name: "main", 598 name: "main",
656 kind: Some( 599 kind: Function,
657 Function,
658 ),
659 container_name: None,
660 description: None,
661 docs: None,
662 }, 600 },
663 kind: Bin, 601 kind: Bin,
664 cfg: None, 602 cfg: None,
@@ -669,12 +607,7 @@ impl Data {
669 0, 607 0,
670 ), 608 ),
671 full_range: 44..98, 609 full_range: 44..98,
672 focus_range: None,
673 name: "foo", 610 name: "foo",
674 kind: None,
675 container_name: None,
676 description: None,
677 docs: None,
678 }, 611 },
679 kind: DocTest { 612 kind: DocTest {
680 test_id: Path( 613 test_id: Path(
@@ -708,16 +641,9 @@ mod test_mod {
708 0, 641 0,
709 ), 642 ),
710 full_range: 1..51, 643 full_range: 1..51,
711 focus_range: Some( 644 focus_range: 5..13,
712 5..13,
713 ),
714 name: "test_mod", 645 name: "test_mod",
715 kind: Some( 646 kind: Module,
716 Module,
717 ),
718 container_name: None,
719 description: None,
720 docs: None,
721 }, 647 },
722 kind: TestMod { 648 kind: TestMod {
723 path: "test_mod", 649 path: "test_mod",
@@ -730,16 +656,9 @@ mod test_mod {
730 0, 656 0,
731 ), 657 ),
732 full_range: 20..49, 658 full_range: 20..49,
733 focus_range: Some( 659 focus_range: 35..44,
734 35..44,
735 ),
736 name: "test_foo1", 660 name: "test_foo1",
737 kind: Some( 661 kind: Function,
738 Function,
739 ),
740 container_name: None,
741 description: None,
742 docs: None,
743 }, 662 },
744 kind: Test { 663 kind: Test {
745 test_id: Path( 664 test_id: Path(
@@ -792,16 +711,9 @@ mod root_tests {
792 0, 711 0,
793 ), 712 ),
794 full_range: 22..323, 713 full_range: 22..323,
795 focus_range: Some( 714 focus_range: 26..40,
796 26..40,
797 ),
798 name: "nested_tests_0", 715 name: "nested_tests_0",
799 kind: Some( 716 kind: Module,
800 Module,
801 ),
802 container_name: None,
803 description: None,
804 docs: None,
805 }, 717 },
806 kind: TestMod { 718 kind: TestMod {
807 path: "root_tests::nested_tests_0", 719 path: "root_tests::nested_tests_0",
@@ -814,16 +726,9 @@ mod root_tests {
814 0, 726 0,
815 ), 727 ),
816 full_range: 51..192, 728 full_range: 51..192,
817 focus_range: Some( 729 focus_range: 55..69,
818 55..69,
819 ),
820 name: "nested_tests_1", 730 name: "nested_tests_1",
821 kind: Some( 731 kind: Module,
822 Module,
823 ),
824 container_name: None,
825 description: None,
826 docs: None,
827 }, 732 },
828 kind: TestMod { 733 kind: TestMod {
829 path: "root_tests::nested_tests_0::nested_tests_1", 734 path: "root_tests::nested_tests_0::nested_tests_1",
@@ -836,16 +741,9 @@ mod root_tests {
836 0, 741 0,
837 ), 742 ),
838 full_range: 84..126, 743 full_range: 84..126,
839 focus_range: Some( 744 focus_range: 107..121,
840 107..121,
841 ),
842 name: "nested_test_11", 745 name: "nested_test_11",
843 kind: Some( 746 kind: Function,
844 Function,
845 ),
846 container_name: None,
847 description: None,
848 docs: None,
849 }, 747 },
850 kind: Test { 748 kind: Test {
851 test_id: Path( 749 test_id: Path(
@@ -863,16 +761,9 @@ mod root_tests {
863 0, 761 0,
864 ), 762 ),
865 full_range: 140..182, 763 full_range: 140..182,
866 focus_range: Some( 764 focus_range: 163..177,
867 163..177,
868 ),
869 name: "nested_test_12", 765 name: "nested_test_12",
870 kind: Some( 766 kind: Function,
871 Function,
872 ),
873 container_name: None,
874 description: None,
875 docs: None,
876 }, 767 },
877 kind: Test { 768 kind: Test {
878 test_id: Path( 769 test_id: Path(
@@ -890,16 +781,9 @@ mod root_tests {
890 0, 781 0,
891 ), 782 ),
892 full_range: 202..286, 783 full_range: 202..286,
893 focus_range: Some( 784 focus_range: 206..220,
894 206..220,
895 ),
896 name: "nested_tests_2", 785 name: "nested_tests_2",
897 kind: Some( 786 kind: Module,
898 Module,
899 ),
900 container_name: None,
901 description: None,
902 docs: None,
903 }, 787 },
904 kind: TestMod { 788 kind: TestMod {
905 path: "root_tests::nested_tests_0::nested_tests_2", 789 path: "root_tests::nested_tests_0::nested_tests_2",
@@ -912,16 +796,9 @@ mod root_tests {
912 0, 796 0,
913 ), 797 ),
914 full_range: 235..276, 798 full_range: 235..276,
915 focus_range: Some( 799 focus_range: 258..271,
916 258..271,
917 ),
918 name: "nested_test_2", 800 name: "nested_test_2",
919 kind: Some( 801 kind: Function,
920 Function,
921 ),
922 container_name: None,
923 description: None,
924 docs: None,
925 }, 802 },
926 kind: Test { 803 kind: Test {
927 test_id: Path( 804 test_id: Path(
@@ -957,16 +834,9 @@ fn test_foo1() {}
957 0, 834 0,
958 ), 835 ),
959 full_range: 1..50, 836 full_range: 1..50,
960 focus_range: Some( 837 focus_range: 36..45,
961 36..45,
962 ),
963 name: "test_foo1", 838 name: "test_foo1",
964 kind: Some( 839 kind: Function,
965 Function,
966 ),
967 container_name: None,
968 description: None,
969 docs: None,
970 }, 840 },
971 kind: Test { 841 kind: Test {
972 test_id: Path( 842 test_id: Path(
@@ -1009,16 +879,9 @@ fn test_foo1() {}
1009 0, 879 0,
1010 ), 880 ),
1011 full_range: 1..72, 881 full_range: 1..72,
1012 focus_range: Some( 882 focus_range: 58..67,
1013 58..67,
1014 ),
1015 name: "test_foo1", 883 name: "test_foo1",
1016 kind: Some( 884 kind: Function,
1017 Function,
1018 ),
1019 container_name: None,
1020 description: None,
1021 docs: None,
1022 }, 885 },
1023 kind: Test { 886 kind: Test {
1024 test_id: Path( 887 test_id: Path(