aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ide/src/display/navigation_target.rs70
-rw-r--r--crates/ide/src/goto_definition.rs2
-rw-r--r--crates/ide/src/hover.rs364
-rw-r--r--crates/ide/src/references.rs2
-rw-r--r--crates/ide/src/runnables.rs139
-rw-r--r--crates/rust-analyzer/src/handlers.rs7
-rw-r--r--crates/rust-analyzer/src/to_proto.rs9
7 files changed, 140 insertions, 453 deletions
diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs
index ac6346b2b..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::{
@@ -35,8 +37,6 @@ pub enum SymbolKind {
35 TypeAlias, 37 TypeAlias,
36 Trait, 38 Trait,
37 Macro, 39 Macro,
38 // Do we actually need this?
39 DocTest,
40} 40}
41 41
42/// `NavigationTarget` represents and element in the editor's UI which you can 42/// `NavigationTarget` represents and element in the editor's UI which you can
@@ -44,7 +44,7 @@ pub enum SymbolKind {
44/// 44///
45/// Typically, a `NavigationTarget` corresponds to some element in the source 45/// Typically, a `NavigationTarget` corresponds to some element in the source
46/// 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.
47#[derive(Debug, Clone, PartialEq, Eq, Hash)] 47#[derive(Clone, PartialEq, Eq, Hash)]
48pub struct NavigationTarget { 48pub struct NavigationTarget {
49 pub file_id: FileId, 49 pub file_id: FileId,
50 /// Range which encompasses the whole element. 50 /// Range which encompasses the whole element.
@@ -64,12 +64,30 @@ pub struct NavigationTarget {
64 /// Clients should place the cursor on this range when navigating to this target. 64 /// Clients should place the cursor on this range when navigating to this target.
65 pub focus_range: Option<TextRange>, 65 pub focus_range: Option<TextRange>,
66 pub name: SmolStr, 66 pub name: SmolStr,
67 pub kind: SymbolKind, 67 pub kind: Option<SymbolKind>,
68 pub container_name: Option<SmolStr>, 68 pub container_name: Option<SmolStr>,
69 pub description: Option<String>, 69 pub description: Option<String>,
70 pub docs: Option<Documentation>, 70 pub docs: Option<Documentation>,
71} 71}
72 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
73pub(crate) trait ToNav { 91pub(crate) trait ToNav {
74 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget; 92 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget;
75} 93}
@@ -110,8 +128,13 @@ impl NavigationTarget {
110 128
111 #[cfg(test)] 129 #[cfg(test)]
112 pub(crate) fn debug_render(&self) -> String { 130 pub(crate) fn debug_render(&self) -> String {
113 let mut buf = 131 let mut buf = format!(
114 format!("{} {:?} {:?} {:?}", self.name, self.kind, self.file_id, self.full_range); 132 "{} {:?} {:?} {:?}",
133 self.name,
134 self.kind.unwrap(),
135 self.file_id,
136 self.full_range
137 );
115 if let Some(focus_range) = self.focus_range { 138 if let Some(focus_range) = self.focus_range {
116 buf.push_str(&format!(" {:?}", focus_range)) 139 buf.push_str(&format!(" {:?}", focus_range))
117 } 140 }
@@ -146,7 +169,7 @@ impl NavigationTarget {
146 NavigationTarget { 169 NavigationTarget {
147 file_id, 170 file_id,
148 name, 171 name,
149 kind, 172 kind: Some(kind),
150 full_range, 173 full_range,
151 focus_range, 174 focus_range,
152 container_name: None, 175 container_name: None,
@@ -161,7 +184,7 @@ impl ToNav for FileSymbol {
161 NavigationTarget { 184 NavigationTarget {
162 file_id: self.file_id, 185 file_id: self.file_id,
163 name: self.name.clone(), 186 name: self.name.clone(),
164 kind: match self.kind { 187 kind: Some(match self.kind {
165 FileSymbolKind::Function => SymbolKind::Function, 188 FileSymbolKind::Function => SymbolKind::Function,
166 FileSymbolKind::Struct => SymbolKind::Struct, 189 FileSymbolKind::Struct => SymbolKind::Struct,
167 FileSymbolKind::Enum => SymbolKind::Enum, 190 FileSymbolKind::Enum => SymbolKind::Enum,
@@ -171,7 +194,7 @@ impl ToNav for FileSymbol {
171 FileSymbolKind::Const => SymbolKind::Const, 194 FileSymbolKind::Const => SymbolKind::Const,
172 FileSymbolKind::Static => SymbolKind::Static, 195 FileSymbolKind::Static => SymbolKind::Static,
173 FileSymbolKind::Macro => SymbolKind::Macro, 196 FileSymbolKind::Macro => SymbolKind::Macro,
174 }, 197 }),
175 full_range: self.range, 198 full_range: self.range,
176 focus_range: self.name_range, 199 focus_range: self.name_range,
177 container_name: self.container_name.clone(), 200 container_name: self.container_name.clone(),
@@ -386,7 +409,7 @@ impl ToNav for hir::Local {
386 NavigationTarget { 409 NavigationTarget {
387 file_id: full_range.file_id, 410 file_id: full_range.file_id,
388 name, 411 name,
389 kind: SymbolKind::Local, 412 kind: Some(SymbolKind::Local),
390 full_range: full_range.range, 413 full_range: full_range.range,
391 focus_range: None, 414 focus_range: None,
392 container_name: None, 415 container_name: None,
@@ -410,7 +433,7 @@ impl ToNav for hir::TypeParam {
410 NavigationTarget { 433 NavigationTarget {
411 file_id: src.file_id.original_file(db), 434 file_id: src.file_id.original_file(db),
412 name: self.name(db).to_string().into(), 435 name: self.name(db).to_string().into(),
413 kind: SymbolKind::TypeParam, 436 kind: Some(SymbolKind::TypeParam),
414 full_range, 437 full_range,
415 focus_range, 438 focus_range,
416 container_name: None, 439 container_name: None,
@@ -427,7 +450,7 @@ impl ToNav for hir::LifetimeParam {
427 NavigationTarget { 450 NavigationTarget {
428 file_id: src.file_id.original_file(db), 451 file_id: src.file_id.original_file(db),
429 name: self.name(db).to_string().into(), 452 name: self.name(db).to_string().into(),
430 kind: SymbolKind::LifetimeParam, 453 kind: Some(SymbolKind::LifetimeParam),
431 full_range, 454 full_range,
432 focus_range: Some(full_range), 455 focus_range: Some(full_range),
433 container_name: None, 456 container_name: None,
@@ -484,34 +507,21 @@ fn foo() { enum FooInner { } }
484 0, 507 0,
485 ), 508 ),
486 full_range: 0..17, 509 full_range: 0..17,
487 focus_range: Some( 510 focus_range: 5..13,
488 5..13,
489 ),
490 name: "FooInner", 511 name: "FooInner",
491 kind: Enum, 512 kind: Enum,
492 container_name: None, 513 description: "enum FooInner",
493 description: Some(
494 "enum FooInner",
495 ),
496 docs: None,
497 }, 514 },
498 NavigationTarget { 515 NavigationTarget {
499 file_id: FileId( 516 file_id: FileId(
500 0, 517 0,
501 ), 518 ),
502 full_range: 29..46, 519 full_range: 29..46,
503 focus_range: Some( 520 focus_range: 34..42,
504 34..42,
505 ),
506 name: "FooInner", 521 name: "FooInner",
507 kind: Enum, 522 kind: Enum,
508 container_name: Some( 523 container_name: "foo",
509 "foo", 524 description: "enum FooInner",
510 ),
511 description: Some(
512 "enum FooInner",
513 ),
514 docs: None,
515 }, 525 },
516 ] 526 ]
517 "#]] 527 "#]]
diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs
index 5bee69f4b..7a12e9965 100644
--- a/crates/ide/src/goto_definition.rs
+++ b/crates/ide/src/goto_definition.rs
@@ -86,7 +86,7 @@ fn self_to_nav_target(self_param: ast::SelfParam, file_id: FileId) -> Option<Nav
86 full_range: self_param.syntax().text_range(), 86 full_range: self_param.syntax().text_range(),
87 focus_range: Some(self_token.text_range()), 87 focus_range: Some(self_token.text_range()),
88 name: self_token.text().clone(), 88 name: self_token.text().clone(),
89 kind: SymbolKind::SelfParam, 89 kind: Some(SymbolKind::SelfParam),
90 container_name: None, 90 container_name: None,
91 description: None, 91 description: None,
92 docs: None, 92 docs: None,
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index dca098af6..b06fa5f15 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -2187,14 +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: Function, 2192 kind: Function,
2195 container_name: None,
2196 description: None,
2197 docs: None,
2198 }, 2193 },
2199 kind: Test { 2194 kind: Test {
2200 test_id: Path( 2195 test_id: Path(
@@ -2230,14 +2225,9 @@ mod tests<|> {
2230 0, 2225 0,
2231 ), 2226 ),
2232 full_range: 0..46, 2227 full_range: 0..46,
2233 focus_range: Some( 2228 focus_range: 4..9,
2234 4..9,
2235 ),
2236 name: "tests", 2229 name: "tests",
2237 kind: Module, 2230 kind: Module,
2238 container_name: None,
2239 description: None,
2240 docs: None,
2241 }, 2231 },
2242 kind: TestMod { 2232 kind: TestMod {
2243 path: "tests", 2233 path: "tests",
@@ -2269,16 +2259,10 @@ fn main() { let s<|>t = S{ f1:0 }; }
2269 0, 2259 0,
2270 ), 2260 ),
2271 full_range: 0..19, 2261 full_range: 0..19,
2272 focus_range: Some( 2262 focus_range: 7..8,
2273 7..8,
2274 ),
2275 name: "S", 2263 name: "S",
2276 kind: Struct, 2264 kind: Struct,
2277 container_name: None, 2265 description: "struct S",
2278 description: Some(
2279 "struct S",
2280 ),
2281 docs: None,
2282 }, 2266 },
2283 }, 2267 },
2284 ], 2268 ],
@@ -2308,16 +2292,10 @@ fn main() { let s<|>t = S{ f1:Arg(0) }; }
2308 0, 2292 0,
2309 ), 2293 ),
2310 full_range: 17..37, 2294 full_range: 17..37,
2311 focus_range: Some( 2295 focus_range: 24..25,
2312 24..25,
2313 ),
2314 name: "S", 2296 name: "S",
2315 kind: Struct, 2297 kind: Struct,
2316 container_name: None, 2298 description: "struct S",
2317 description: Some(
2318 "struct S",
2319 ),
2320 docs: None,
2321 }, 2299 },
2322 }, 2300 },
2323 HoverGotoTypeData { 2301 HoverGotoTypeData {
@@ -2327,16 +2305,10 @@ fn main() { let s<|>t = S{ f1:Arg(0) }; }
2327 0, 2305 0,
2328 ), 2306 ),
2329 full_range: 0..16, 2307 full_range: 0..16,
2330 focus_range: Some( 2308 focus_range: 7..10,
2331 7..10,
2332 ),
2333 name: "Arg", 2309 name: "Arg",
2334 kind: Struct, 2310 kind: Struct,
2335 container_name: None, 2311 description: "struct Arg",
2336 description: Some(
2337 "struct Arg",
2338 ),
2339 docs: None,
2340 }, 2312 },
2341 }, 2313 },
2342 ], 2314 ],
@@ -2366,16 +2338,10 @@ fn main() { let s<|>t = S{ f1: S{ f1: Arg(0) } }; }
2366 0, 2338 0,
2367 ), 2339 ),
2368 full_range: 17..37, 2340 full_range: 17..37,
2369 focus_range: Some( 2341 focus_range: 24..25,
2370 24..25,
2371 ),
2372 name: "S", 2342 name: "S",
2373 kind: Struct, 2343 kind: Struct,
2374 container_name: None, 2344 description: "struct S",
2375 description: Some(
2376 "struct S",
2377 ),
2378 docs: None,
2379 }, 2345 },
2380 }, 2346 },
2381 HoverGotoTypeData { 2347 HoverGotoTypeData {
@@ -2385,16 +2351,10 @@ fn main() { let s<|>t = S{ f1: S{ f1: Arg(0) } }; }
2385 0, 2351 0,
2386 ), 2352 ),
2387 full_range: 0..16, 2353 full_range: 0..16,
2388 focus_range: Some( 2354 focus_range: 7..10,
2389 7..10,
2390 ),
2391 name: "Arg", 2355 name: "Arg",
2392 kind: Struct, 2356 kind: Struct,
2393 container_name: None, 2357 description: "struct Arg",
2394 description: Some(
2395 "struct Arg",
2396 ),
2397 docs: None,
2398 }, 2358 },
2399 }, 2359 },
2400 ], 2360 ],
@@ -2427,16 +2387,10 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); }
2427 0, 2387 0,
2428 ), 2388 ),
2429 full_range: 0..14, 2389 full_range: 0..14,
2430 focus_range: Some( 2390 focus_range: 7..8,
2431 7..8,
2432 ),
2433 name: "A", 2391 name: "A",
2434 kind: Struct, 2392 kind: Struct,
2435 container_name: None, 2393 description: "struct A",
2436 description: Some(
2437 "struct A",
2438 ),
2439 docs: None,
2440 }, 2394 },
2441 }, 2395 },
2442 HoverGotoTypeData { 2396 HoverGotoTypeData {
@@ -2446,16 +2400,10 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); }
2446 0, 2400 0,
2447 ), 2401 ),
2448 full_range: 15..29, 2402 full_range: 15..29,
2449 focus_range: Some( 2403 focus_range: 22..23,
2450 22..23,
2451 ),
2452 name: "B", 2404 name: "B",
2453 kind: Struct, 2405 kind: Struct,
2454 container_name: None, 2406 description: "struct B",
2455 description: Some(
2456 "struct B",
2457 ),
2458 docs: None,
2459 }, 2407 },
2460 }, 2408 },
2461 HoverGotoTypeData { 2409 HoverGotoTypeData {
@@ -2465,16 +2413,10 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); }
2465 0, 2413 0,
2466 ), 2414 ),
2467 full_range: 42..60, 2415 full_range: 42..60,
2468 focus_range: Some( 2416 focus_range: 53..54,
2469 53..54,
2470 ),
2471 name: "C", 2417 name: "C",
2472 kind: Struct, 2418 kind: Struct,
2473 container_name: None, 2419 description: "pub struct C",
2474 description: Some(
2475 "pub struct C",
2476 ),
2477 docs: None,
2478 }, 2420 },
2479 }, 2421 },
2480 ], 2422 ],
@@ -2504,16 +2446,10 @@ fn main() { let s<|>t = foo(); }
2504 0, 2446 0,
2505 ), 2447 ),
2506 full_range: 0..12, 2448 full_range: 0..12,
2507 focus_range: Some( 2449 focus_range: 6..9,
2508 6..9,
2509 ),
2510 name: "Foo", 2450 name: "Foo",
2511 kind: Trait, 2451 kind: Trait,
2512 container_name: None, 2452 description: "trait Foo",
2513 description: Some(
2514 "trait Foo",
2515 ),
2516 docs: None,
2517 }, 2453 },
2518 }, 2454 },
2519 ], 2455 ],
@@ -2544,16 +2480,10 @@ fn main() { let s<|>t = foo(); }
2544 0, 2480 0,
2545 ), 2481 ),
2546 full_range: 0..15, 2482 full_range: 0..15,
2547 focus_range: Some( 2483 focus_range: 6..9,
2548 6..9,
2549 ),
2550 name: "Foo", 2484 name: "Foo",
2551 kind: Trait, 2485 kind: Trait,
2552 container_name: None, 2486 description: "trait Foo",
2553 description: Some(
2554 "trait Foo",
2555 ),
2556 docs: None,
2557 }, 2487 },
2558 }, 2488 },
2559 HoverGotoTypeData { 2489 HoverGotoTypeData {
@@ -2563,16 +2493,10 @@ fn main() { let s<|>t = foo(); }
2563 0, 2493 0,
2564 ), 2494 ),
2565 full_range: 16..25, 2495 full_range: 16..25,
2566 focus_range: Some( 2496 focus_range: 23..24,
2567 23..24,
2568 ),
2569 name: "S", 2497 name: "S",
2570 kind: Struct, 2498 kind: Struct,
2571 container_name: None, 2499 description: "struct S",
2572 description: Some(
2573 "struct S",
2574 ),
2575 docs: None,
2576 }, 2500 },
2577 }, 2501 },
2578 ], 2502 ],
@@ -2603,16 +2527,10 @@ fn main() { let s<|>t = foo(); }
2603 0, 2527 0,
2604 ), 2528 ),
2605 full_range: 0..12, 2529 full_range: 0..12,
2606 focus_range: Some( 2530 focus_range: 6..9,
2607 6..9,
2608 ),
2609 name: "Foo", 2531 name: "Foo",
2610 kind: Trait, 2532 kind: Trait,
2611 container_name: None, 2533 description: "trait Foo",
2612 description: Some(
2613 "trait Foo",
2614 ),
2615 docs: None,
2616 }, 2534 },
2617 }, 2535 },
2618 HoverGotoTypeData { 2536 HoverGotoTypeData {
@@ -2622,16 +2540,10 @@ fn main() { let s<|>t = foo(); }
2622 0, 2540 0,
2623 ), 2541 ),
2624 full_range: 13..25, 2542 full_range: 13..25,
2625 focus_range: Some( 2543 focus_range: 19..22,
2626 19..22,
2627 ),
2628 name: "Bar", 2544 name: "Bar",
2629 kind: Trait, 2545 kind: Trait,
2630 container_name: None, 2546 description: "trait Bar",
2631 description: Some(
2632 "trait Bar",
2633 ),
2634 docs: None,
2635 }, 2547 },
2636 }, 2548 },
2637 ], 2549 ],
@@ -2665,16 +2577,10 @@ fn main() { let s<|>t = foo(); }
2665 0, 2577 0,
2666 ), 2578 ),
2667 full_range: 0..15, 2579 full_range: 0..15,
2668 focus_range: Some( 2580 focus_range: 6..9,
2669 6..9,
2670 ),
2671 name: "Foo", 2581 name: "Foo",
2672 kind: Trait, 2582 kind: Trait,
2673 container_name: None, 2583 description: "trait Foo",
2674 description: Some(
2675 "trait Foo",
2676 ),
2677 docs: None,
2678 }, 2584 },
2679 }, 2585 },
2680 HoverGotoTypeData { 2586 HoverGotoTypeData {
@@ -2684,16 +2590,10 @@ fn main() { let s<|>t = foo(); }
2684 0, 2590 0,
2685 ), 2591 ),
2686 full_range: 16..31, 2592 full_range: 16..31,
2687 focus_range: Some( 2593 focus_range: 22..25,
2688 22..25,
2689 ),
2690 name: "Bar", 2594 name: "Bar",
2691 kind: Trait, 2595 kind: Trait,
2692 container_name: None, 2596 description: "trait Bar",
2693 description: Some(
2694 "trait Bar",
2695 ),
2696 docs: None,
2697 }, 2597 },
2698 }, 2598 },
2699 HoverGotoTypeData { 2599 HoverGotoTypeData {
@@ -2703,16 +2603,10 @@ fn main() { let s<|>t = foo(); }
2703 0, 2603 0,
2704 ), 2604 ),
2705 full_range: 32..44, 2605 full_range: 32..44,
2706 focus_range: Some( 2606 focus_range: 39..41,
2707 39..41,
2708 ),
2709 name: "S1", 2607 name: "S1",
2710 kind: Struct, 2608 kind: Struct,
2711 container_name: None, 2609 description: "struct S1",
2712 description: Some(
2713 "struct S1",
2714 ),
2715 docs: None,
2716 }, 2610 },
2717 }, 2611 },
2718 HoverGotoTypeData { 2612 HoverGotoTypeData {
@@ -2722,16 +2616,10 @@ fn main() { let s<|>t = foo(); }
2722 0, 2616 0,
2723 ), 2617 ),
2724 full_range: 45..57, 2618 full_range: 45..57,
2725 focus_range: Some( 2619 focus_range: 52..54,
2726 52..54,
2727 ),
2728 name: "S2", 2620 name: "S2",
2729 kind: Struct, 2621 kind: Struct,
2730 container_name: None, 2622 description: "struct S2",
2731 description: Some(
2732 "struct S2",
2733 ),
2734 docs: None,
2735 }, 2623 },
2736 }, 2624 },
2737 ], 2625 ],
@@ -2759,16 +2647,10 @@ fn foo(ar<|>g: &impl Foo) {}
2759 0, 2647 0,
2760 ), 2648 ),
2761 full_range: 0..12, 2649 full_range: 0..12,
2762 focus_range: Some( 2650 focus_range: 6..9,
2763 6..9,
2764 ),
2765 name: "Foo", 2651 name: "Foo",
2766 kind: Trait, 2652 kind: Trait,
2767 container_name: None, 2653 description: "trait Foo",
2768 description: Some(
2769 "trait Foo",
2770 ),
2771 docs: None,
2772 }, 2654 },
2773 }, 2655 },
2774 ], 2656 ],
@@ -2799,16 +2681,10 @@ fn foo(ar<|>g: &impl Foo + Bar<S>) {}
2799 0, 2681 0,
2800 ), 2682 ),
2801 full_range: 0..12, 2683 full_range: 0..12,
2802 focus_range: Some( 2684 focus_range: 6..9,
2803 6..9,
2804 ),
2805 name: "Foo", 2685 name: "Foo",
2806 kind: Trait, 2686 kind: Trait,
2807 container_name: None, 2687 description: "trait Foo",
2808 description: Some(
2809 "trait Foo",
2810 ),
2811 docs: None,
2812 }, 2688 },
2813 }, 2689 },
2814 HoverGotoTypeData { 2690 HoverGotoTypeData {
@@ -2818,16 +2694,10 @@ fn foo(ar<|>g: &impl Foo + Bar<S>) {}
2818 0, 2694 0,
2819 ), 2695 ),
2820 full_range: 13..28, 2696 full_range: 13..28,
2821 focus_range: Some( 2697 focus_range: 19..22,
2822 19..22,
2823 ),
2824 name: "Bar", 2698 name: "Bar",
2825 kind: Trait, 2699 kind: Trait,
2826 container_name: None, 2700 description: "trait Bar",
2827 description: Some(
2828 "trait Bar",
2829 ),
2830 docs: None,
2831 }, 2701 },
2832 }, 2702 },
2833 HoverGotoTypeData { 2703 HoverGotoTypeData {
@@ -2837,16 +2707,10 @@ fn foo(ar<|>g: &impl Foo + Bar<S>) {}
2837 0, 2707 0,
2838 ), 2708 ),
2839 full_range: 29..39, 2709 full_range: 29..39,
2840 focus_range: Some( 2710 focus_range: 36..37,
2841 36..37,
2842 ),
2843 name: "S", 2711 name: "S",
2844 kind: Struct, 2712 kind: Struct,
2845 container_name: None, 2713 description: "struct S",
2846 description: Some(
2847 "struct S",
2848 ),
2849 docs: None,
2850 }, 2714 },
2851 }, 2715 },
2852 ], 2716 ],
@@ -2882,16 +2746,10 @@ mod future {
2882 0, 2746 0,
2883 ), 2747 ),
2884 full_range: 101..163, 2748 full_range: 101..163,
2885 focus_range: Some( 2749 focus_range: 140..146,
2886 140..146,
2887 ),
2888 name: "Future", 2750 name: "Future",
2889 kind: Trait, 2751 kind: Trait,
2890 container_name: None, 2752 description: "pub trait Future",
2891 description: Some(
2892 "pub trait Future",
2893 ),
2894 docs: None,
2895 }, 2753 },
2896 }, 2754 },
2897 HoverGotoTypeData { 2755 HoverGotoTypeData {
@@ -2901,16 +2759,10 @@ mod future {
2901 0, 2759 0,
2902 ), 2760 ),
2903 full_range: 0..9, 2761 full_range: 0..9,
2904 focus_range: Some( 2762 focus_range: 7..8,
2905 7..8,
2906 ),
2907 name: "S", 2763 name: "S",
2908 kind: Struct, 2764 kind: Struct,
2909 container_name: None, 2765 description: "struct S",
2910 description: Some(
2911 "struct S",
2912 ),
2913 docs: None,
2914 }, 2766 },
2915 }, 2767 },
2916 ], 2768 ],
@@ -2939,16 +2791,10 @@ fn foo(ar<|>g: &impl Foo<S>) {}
2939 0, 2791 0,
2940 ), 2792 ),
2941 full_range: 0..15, 2793 full_range: 0..15,
2942 focus_range: Some( 2794 focus_range: 6..9,
2943 6..9,
2944 ),
2945 name: "Foo", 2795 name: "Foo",
2946 kind: Trait, 2796 kind: Trait,
2947 container_name: None, 2797 description: "trait Foo",
2948 description: Some(
2949 "trait Foo",
2950 ),
2951 docs: None,
2952 }, 2798 },
2953 }, 2799 },
2954 HoverGotoTypeData { 2800 HoverGotoTypeData {
@@ -2958,16 +2804,10 @@ fn foo(ar<|>g: &impl Foo<S>) {}
2958 0, 2804 0,
2959 ), 2805 ),
2960 full_range: 16..27, 2806 full_range: 16..27,
2961 focus_range: Some( 2807 focus_range: 23..24,
2962 23..24,
2963 ),
2964 name: "S", 2808 name: "S",
2965 kind: Struct, 2809 kind: Struct,
2966 container_name: None, 2810 description: "struct S",
2967 description: Some(
2968 "struct S",
2969 ),
2970 docs: None,
2971 }, 2811 },
2972 }, 2812 },
2973 ], 2813 ],
@@ -3001,16 +2841,10 @@ fn main() { let s<|>t = foo(); }
3001 0, 2841 0,
3002 ), 2842 ),
3003 full_range: 42..55, 2843 full_range: 42..55,
3004 focus_range: Some( 2844 focus_range: 49..50,
3005 49..50,
3006 ),
3007 name: "B", 2845 name: "B",
3008 kind: Struct, 2846 kind: Struct,
3009 container_name: None, 2847 description: "struct B",
3010 description: Some(
3011 "struct B",
3012 ),
3013 docs: None,
3014 }, 2848 },
3015 }, 2849 },
3016 HoverGotoTypeData { 2850 HoverGotoTypeData {
@@ -3020,16 +2854,10 @@ fn main() { let s<|>t = foo(); }
3020 0, 2854 0,
3021 ), 2855 ),
3022 full_range: 0..12, 2856 full_range: 0..12,
3023 focus_range: Some( 2857 focus_range: 6..9,
3024 6..9,
3025 ),
3026 name: "Foo", 2858 name: "Foo",
3027 kind: Trait, 2859 kind: Trait,
3028 container_name: None, 2860 description: "trait Foo",
3029 description: Some(
3030 "trait Foo",
3031 ),
3032 docs: None,
3033 }, 2861 },
3034 }, 2862 },
3035 ], 2863 ],
@@ -3057,16 +2885,10 @@ fn foo(ar<|>g: &dyn Foo) {}
3057 0, 2885 0,
3058 ), 2886 ),
3059 full_range: 0..12, 2887 full_range: 0..12,
3060 focus_range: Some( 2888 focus_range: 6..9,
3061 6..9,
3062 ),
3063 name: "Foo", 2889 name: "Foo",
3064 kind: Trait, 2890 kind: Trait,
3065 container_name: None, 2891 description: "trait Foo",
3066 description: Some(
3067 "trait Foo",
3068 ),
3069 docs: None,
3070 }, 2892 },
3071 }, 2893 },
3072 ], 2894 ],
@@ -3095,16 +2917,10 @@ fn foo(ar<|>g: &dyn Foo<S>) {}
3095 0, 2917 0,
3096 ), 2918 ),
3097 full_range: 0..15, 2919 full_range: 0..15,
3098 focus_range: Some( 2920 focus_range: 6..9,
3099 6..9,
3100 ),
3101 name: "Foo", 2921 name: "Foo",
3102 kind: Trait, 2922 kind: Trait,
3103 container_name: None, 2923 description: "trait Foo",
3104 description: Some(
3105 "trait Foo",
3106 ),
3107 docs: None,
3108 }, 2924 },
3109 }, 2925 },
3110 HoverGotoTypeData { 2926 HoverGotoTypeData {
@@ -3114,16 +2930,10 @@ fn foo(ar<|>g: &dyn Foo<S>) {}
3114 0, 2930 0,
3115 ), 2931 ),
3116 full_range: 16..27, 2932 full_range: 16..27,
3117 focus_range: Some( 2933 focus_range: 23..24,
3118 23..24,
3119 ),
3120 name: "S", 2934 name: "S",
3121 kind: Struct, 2935 kind: Struct,
3122 container_name: None, 2936 description: "struct S",
3123 description: Some(
3124 "struct S",
3125 ),
3126 docs: None,
3127 }, 2937 },
3128 }, 2938 },
3129 ], 2939 ],
@@ -3155,16 +2965,10 @@ fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {}
3155 0, 2965 0,
3156 ), 2966 ),
3157 full_range: 0..21, 2967 full_range: 0..21,
3158 focus_range: Some( 2968 focus_range: 6..15,
3159 6..15,
3160 ),
3161 name: "ImplTrait", 2969 name: "ImplTrait",
3162 kind: Trait, 2970 kind: Trait,
3163 container_name: None, 2971 description: "trait ImplTrait",
3164 description: Some(
3165 "trait ImplTrait",
3166 ),
3167 docs: None,
3168 }, 2972 },
3169 }, 2973 },
3170 HoverGotoTypeData { 2974 HoverGotoTypeData {
@@ -3174,16 +2978,10 @@ fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {}
3174 0, 2978 0,
3175 ), 2979 ),
3176 full_range: 43..57, 2980 full_range: 43..57,
3177 focus_range: Some( 2981 focus_range: 50..51,
3178 50..51,
3179 ),
3180 name: "B", 2982 name: "B",
3181 kind: Struct, 2983 kind: Struct,
3182 container_name: None, 2984 description: "struct B",
3183 description: Some(
3184 "struct B",
3185 ),
3186 docs: None,
3187 }, 2985 },
3188 }, 2986 },
3189 HoverGotoTypeData { 2987 HoverGotoTypeData {
@@ -3193,16 +2991,10 @@ fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {}
3193 0, 2991 0,
3194 ), 2992 ),
3195 full_range: 22..42, 2993 full_range: 22..42,
3196 focus_range: Some( 2994 focus_range: 28..36,
3197 28..36,
3198 ),
3199 name: "DynTrait", 2995 name: "DynTrait",
3200 kind: Trait, 2996 kind: Trait,
3201 container_name: None, 2997 description: "trait DynTrait",
3202 description: Some(
3203 "trait DynTrait",
3204 ),
3205 docs: None,
3206 }, 2998 },
3207 }, 2999 },
3208 HoverGotoTypeData { 3000 HoverGotoTypeData {
@@ -3212,16 +3004,10 @@ fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {}
3212 0, 3004 0,
3213 ), 3005 ),
3214 full_range: 58..69, 3006 full_range: 58..69,
3215 focus_range: Some( 3007 focus_range: 65..66,
3216 65..66,
3217 ),
3218 name: "S", 3008 name: "S",
3219 kind: Struct, 3009 kind: Struct,
3220 container_name: None, 3010 description: "struct S",
3221 description: Some(
3222 "struct S",
3223 ),
3224 docs: None,
3225 }, 3011 },
3226 }, 3012 },
3227 ], 3013 ],
@@ -3260,16 +3046,10 @@ fn main() { let s<|>t = test().get(); }
3260 0, 3046 0,
3261 ), 3047 ),
3262 full_range: 0..62, 3048 full_range: 0..62,
3263 focus_range: Some( 3049 focus_range: 6..9,
3264 6..9,
3265 ),
3266 name: "Foo", 3050 name: "Foo",
3267 kind: Trait, 3051 kind: Trait,
3268 container_name: None, 3052 description: "trait Foo",
3269 description: Some(
3270 "trait Foo",
3271 ),
3272 docs: None,
3273 }, 3053 },
3274 }, 3054 },
3275 ], 3055 ],
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs
index d8069eb64..8c00a7105 100644
--- a/crates/ide/src/references.rs
+++ b/crates/ide/src/references.rs
@@ -278,7 +278,7 @@ fn try_find_self_references(
278 full_range: self_param.syntax().text_range(), 278 full_range: self_param.syntax().text_range(),
279 focus_range: Some(param_self_token.text_range()), 279 focus_range: Some(param_self_token.text_range()),
280 name: param_self_token.text().clone(), 280 name: param_self_token.text().clone(),
281 kind: SymbolKind::SelfParam, 281 kind: Some(SymbolKind::SelfParam),
282 container_name: None, 282 container_name: None,
283 description: None, 283 description: None,
284 docs: None, 284 docs: None,
diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs
index 600e93b6a..ff386be80 100644
--- a/crates/ide/src/runnables.rs
+++ b/crates/ide/src/runnables.rs
@@ -208,7 +208,7 @@ fn module_def_doctest(sema: &Semantics<RootDatabase>, def: hir::ModuleDef) -> Op
208 nav.focus_range = None; 208 nav.focus_range = None;
209 nav.description = None; 209 nav.description = None;
210 nav.docs = None; 210 nav.docs = None;
211 nav.kind = SymbolKind::DocTest; 211 nav.kind = None;
212 let res = Runnable { nav, kind: RunnableKind::DocTest { test_id }, cfg: attrs.cfg() }; 212 let res = Runnable { nav, kind: RunnableKind::DocTest { test_id }, cfg: attrs.cfg() };
213 Some(res) 213 Some(res)
214} 214}
@@ -352,14 +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: Function, 357 kind: Function,
360 container_name: None,
361 description: None,
362 docs: None,
363 }, 358 },
364 kind: Bin, 359 kind: Bin,
365 cfg: None, 360 cfg: None,
@@ -370,14 +365,9 @@ fn bench() {}
370 0, 365 0,
371 ), 366 ),
372 full_range: 15..39, 367 full_range: 15..39,
373 focus_range: Some( 368 focus_range: 26..34,
374 26..34,
375 ),
376 name: "test_foo", 369 name: "test_foo",
377 kind: Function, 370 kind: Function,
378 container_name: None,
379 description: None,
380 docs: None,
381 }, 371 },
382 kind: Test { 372 kind: Test {
383 test_id: Path( 373 test_id: Path(
@@ -395,14 +385,9 @@ fn bench() {}
395 0, 385 0,
396 ), 386 ),
397 full_range: 41..75, 387 full_range: 41..75,
398 focus_range: Some( 388 focus_range: 62..70,
399 62..70,
400 ),
401 name: "test_foo", 389 name: "test_foo",
402 kind: Function, 390 kind: Function,
403 container_name: None,
404 description: None,
405 docs: None,
406 }, 391 },
407 kind: Test { 392 kind: Test {
408 test_id: Path( 393 test_id: Path(
@@ -420,14 +405,9 @@ fn bench() {}
420 0, 405 0,
421 ), 406 ),
422 full_range: 77..99, 407 full_range: 77..99,
423 focus_range: Some( 408 focus_range: 89..94,
424 89..94,
425 ),
426 name: "bench", 409 name: "bench",
427 kind: Function, 410 kind: Function,
428 container_name: None,
429 description: None,
430 docs: None,
431 }, 411 },
432 kind: Bench { 412 kind: Bench {
433 test_id: Path( 413 test_id: Path(
@@ -517,14 +497,9 @@ struct StructWithRunnable(String);
517 0, 497 0,
518 ), 498 ),
519 full_range: 1..13, 499 full_range: 1..13,
520 focus_range: Some( 500 focus_range: 4..8,
521 4..8,
522 ),
523 name: "main", 501 name: "main",
524 kind: Function, 502 kind: Function,
525 container_name: None,
526 description: None,
527 docs: None,
528 }, 503 },
529 kind: Bin, 504 kind: Bin,
530 cfg: None, 505 cfg: None,
@@ -535,12 +510,7 @@ struct StructWithRunnable(String);
535 0, 510 0,
536 ), 511 ),
537 full_range: 15..74, 512 full_range: 15..74,
538 focus_range: None,
539 name: "should_have_runnable", 513 name: "should_have_runnable",
540 kind: DocTest,
541 container_name: None,
542 description: None,
543 docs: None,
544 }, 514 },
545 kind: DocTest { 515 kind: DocTest {
546 test_id: Path( 516 test_id: Path(
@@ -555,12 +525,7 @@ struct StructWithRunnable(String);
555 0, 525 0,
556 ), 526 ),
557 full_range: 76..148, 527 full_range: 76..148,
558 focus_range: None,
559 name: "should_have_runnable_1", 528 name: "should_have_runnable_1",
560 kind: DocTest,
561 container_name: None,
562 description: None,
563 docs: None,
564 }, 529 },
565 kind: DocTest { 530 kind: DocTest {
566 test_id: Path( 531 test_id: Path(
@@ -575,12 +540,7 @@ struct StructWithRunnable(String);
575 0, 540 0,
576 ), 541 ),
577 full_range: 150..254, 542 full_range: 150..254,
578 focus_range: None,
579 name: "should_have_runnable_2", 543 name: "should_have_runnable_2",
580 kind: DocTest,
581 container_name: None,
582 description: None,
583 docs: None,
584 }, 544 },
585 kind: DocTest { 545 kind: DocTest {
586 test_id: Path( 546 test_id: Path(
@@ -595,12 +555,7 @@ struct StructWithRunnable(String);
595 0, 555 0,
596 ), 556 ),
597 full_range: 756..821, 557 full_range: 756..821,
598 focus_range: None,
599 name: "StructWithRunnable", 558 name: "StructWithRunnable",
600 kind: DocTest,
601 container_name: None,
602 description: None,
603 docs: None,
604 }, 559 },
605 kind: DocTest { 560 kind: DocTest {
606 test_id: Path( 561 test_id: Path(
@@ -639,14 +594,9 @@ impl Data {
639 0, 594 0,
640 ), 595 ),
641 full_range: 1..13, 596 full_range: 1..13,
642 focus_range: Some( 597 focus_range: 4..8,
643 4..8,
644 ),
645 name: "main", 598 name: "main",
646 kind: Function, 599 kind: Function,
647 container_name: None,
648 description: None,
649 docs: None,
650 }, 600 },
651 kind: Bin, 601 kind: Bin,
652 cfg: None, 602 cfg: None,
@@ -657,12 +607,7 @@ impl Data {
657 0, 607 0,
658 ), 608 ),
659 full_range: 44..98, 609 full_range: 44..98,
660 focus_range: None,
661 name: "foo", 610 name: "foo",
662 kind: DocTest,
663 container_name: None,
664 description: None,
665 docs: None,
666 }, 611 },
667 kind: DocTest { 612 kind: DocTest {
668 test_id: Path( 613 test_id: Path(
@@ -696,14 +641,9 @@ mod test_mod {
696 0, 641 0,
697 ), 642 ),
698 full_range: 1..51, 643 full_range: 1..51,
699 focus_range: Some( 644 focus_range: 5..13,
700 5..13,
701 ),
702 name: "test_mod", 645 name: "test_mod",
703 kind: Module, 646 kind: Module,
704 container_name: None,
705 description: None,
706 docs: None,
707 }, 647 },
708 kind: TestMod { 648 kind: TestMod {
709 path: "test_mod", 649 path: "test_mod",
@@ -716,14 +656,9 @@ mod test_mod {
716 0, 656 0,
717 ), 657 ),
718 full_range: 20..49, 658 full_range: 20..49,
719 focus_range: Some( 659 focus_range: 35..44,
720 35..44,
721 ),
722 name: "test_foo1", 660 name: "test_foo1",
723 kind: Function, 661 kind: Function,
724 container_name: None,
725 description: None,
726 docs: None,
727 }, 662 },
728 kind: Test { 663 kind: Test {
729 test_id: Path( 664 test_id: Path(
@@ -776,14 +711,9 @@ mod root_tests {
776 0, 711 0,
777 ), 712 ),
778 full_range: 22..323, 713 full_range: 22..323,
779 focus_range: Some( 714 focus_range: 26..40,
780 26..40,
781 ),
782 name: "nested_tests_0", 715 name: "nested_tests_0",
783 kind: Module, 716 kind: Module,
784 container_name: None,
785 description: None,
786 docs: None,
787 }, 717 },
788 kind: TestMod { 718 kind: TestMod {
789 path: "root_tests::nested_tests_0", 719 path: "root_tests::nested_tests_0",
@@ -796,14 +726,9 @@ mod root_tests {
796 0, 726 0,
797 ), 727 ),
798 full_range: 51..192, 728 full_range: 51..192,
799 focus_range: Some( 729 focus_range: 55..69,
800 55..69,
801 ),
802 name: "nested_tests_1", 730 name: "nested_tests_1",
803 kind: Module, 731 kind: Module,
804 container_name: None,
805 description: None,
806 docs: None,
807 }, 732 },
808 kind: TestMod { 733 kind: TestMod {
809 path: "root_tests::nested_tests_0::nested_tests_1", 734 path: "root_tests::nested_tests_0::nested_tests_1",
@@ -816,14 +741,9 @@ mod root_tests {
816 0, 741 0,
817 ), 742 ),
818 full_range: 84..126, 743 full_range: 84..126,
819 focus_range: Some( 744 focus_range: 107..121,
820 107..121,
821 ),
822 name: "nested_test_11", 745 name: "nested_test_11",
823 kind: Function, 746 kind: Function,
824 container_name: None,
825 description: None,
826 docs: None,
827 }, 747 },
828 kind: Test { 748 kind: Test {
829 test_id: Path( 749 test_id: Path(
@@ -841,14 +761,9 @@ mod root_tests {
841 0, 761 0,
842 ), 762 ),
843 full_range: 140..182, 763 full_range: 140..182,
844 focus_range: Some( 764 focus_range: 163..177,
845 163..177,
846 ),
847 name: "nested_test_12", 765 name: "nested_test_12",
848 kind: Function, 766 kind: Function,
849 container_name: None,
850 description: None,
851 docs: None,
852 }, 767 },
853 kind: Test { 768 kind: Test {
854 test_id: Path( 769 test_id: Path(
@@ -866,14 +781,9 @@ mod root_tests {
866 0, 781 0,
867 ), 782 ),
868 full_range: 202..286, 783 full_range: 202..286,
869 focus_range: Some( 784 focus_range: 206..220,
870 206..220,
871 ),
872 name: "nested_tests_2", 785 name: "nested_tests_2",
873 kind: Module, 786 kind: Module,
874 container_name: None,
875 description: None,
876 docs: None,
877 }, 787 },
878 kind: TestMod { 788 kind: TestMod {
879 path: "root_tests::nested_tests_0::nested_tests_2", 789 path: "root_tests::nested_tests_0::nested_tests_2",
@@ -886,14 +796,9 @@ mod root_tests {
886 0, 796 0,
887 ), 797 ),
888 full_range: 235..276, 798 full_range: 235..276,
889 focus_range: Some( 799 focus_range: 258..271,
890 258..271,
891 ),
892 name: "nested_test_2", 800 name: "nested_test_2",
893 kind: Function, 801 kind: Function,
894 container_name: None,
895 description: None,
896 docs: None,
897 }, 802 },
898 kind: Test { 803 kind: Test {
899 test_id: Path( 804 test_id: Path(
@@ -929,14 +834,9 @@ fn test_foo1() {}
929 0, 834 0,
930 ), 835 ),
931 full_range: 1..50, 836 full_range: 1..50,
932 focus_range: Some( 837 focus_range: 36..45,
933 36..45,
934 ),
935 name: "test_foo1", 838 name: "test_foo1",
936 kind: Function, 839 kind: Function,
937 container_name: None,
938 description: None,
939 docs: None,
940 }, 840 },
941 kind: Test { 841 kind: Test {
942 test_id: Path( 842 test_id: Path(
@@ -979,14 +879,9 @@ fn test_foo1() {}
979 0, 879 0,
980 ), 880 ),
981 full_range: 1..72, 881 full_range: 1..72,
982 focus_range: Some( 882 focus_range: 58..67,
983 58..67,
984 ),
985 name: "test_foo1", 883 name: "test_foo1",
986 kind: Function, 884 kind: Function,
987 container_name: None,
988 description: None,
989 docs: None,
990 }, 885 },
991 kind: Test { 886 kind: Test {
992 test_id: Path( 887 test_id: Path(
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs
index 404b35025..66f8bee99 100644
--- a/crates/rust-analyzer/src/handlers.rs
+++ b/crates/rust-analyzer/src/handlers.rs
@@ -385,7 +385,10 @@ pub(crate) fn handle_workspace_symbol(
385 #[allow(deprecated)] 385 #[allow(deprecated)]
386 let info = SymbolInformation { 386 let info = SymbolInformation {
387 name: nav.name.to_string(), 387 name: nav.name.to_string(),
388 kind: to_proto::symbol_kind(nav.kind), 388 kind: nav
389 .kind
390 .map(to_proto::symbol_kind)
391 .unwrap_or(lsp_types::SymbolKind::Variable),
389 tags: None, 392 tags: None,
390 location: to_proto::location_from_nav(snap, nav)?, 393 location: to_proto::location_from_nav(snap, nav)?,
391 container_name, 394 container_name,
@@ -1263,7 +1266,7 @@ pub(crate) fn handle_call_hierarchy_prepare(
1263 let RangeInfo { range: _, info: navs } = nav_info; 1266 let RangeInfo { range: _, info: navs } = nav_info;
1264 let res = navs 1267 let res = navs
1265 .into_iter() 1268 .into_iter()
1266 .filter(|it| it.kind == SymbolKind::Function) 1269 .filter(|it| it.kind == Some(SymbolKind::Function))
1267 .map(|it| to_proto::call_hierarchy_item(&snap, it)) 1270 .map(|it| to_proto::call_hierarchy_item(&snap, it))
1268 .collect::<Result<Vec<_>>>()?; 1271 .collect::<Result<Vec<_>>>()?;
1269 1272
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs
index 79caafe80..6b2302803 100644
--- a/crates/rust-analyzer/src/to_proto.rs
+++ b/crates/rust-analyzer/src/to_proto.rs
@@ -43,10 +43,9 @@ pub(crate) fn symbol_kind(symbol_kind: SymbolKind) -> lsp_types::SymbolKind {
43 SymbolKind::Static => lsp_types::SymbolKind::Constant, 43 SymbolKind::Static => lsp_types::SymbolKind::Constant,
44 SymbolKind::Const => lsp_types::SymbolKind::Constant, 44 SymbolKind::Const => lsp_types::SymbolKind::Constant,
45 SymbolKind::Impl => lsp_types::SymbolKind::Object, 45 SymbolKind::Impl => lsp_types::SymbolKind::Object,
46 SymbolKind::Local 46 SymbolKind::Local | SymbolKind::SelfParam | SymbolKind::LifetimeParam => {
47 | SymbolKind::SelfParam 47 lsp_types::SymbolKind::Variable
48 | SymbolKind::LifetimeParam 48 }
49 | SymbolKind::DocTest => lsp_types::SymbolKind::Variable,
50 SymbolKind::Union => lsp_types::SymbolKind::Struct, 49 SymbolKind::Union => lsp_types::SymbolKind::Struct,
51 } 50 }
52} 51}
@@ -722,7 +721,7 @@ pub(crate) fn call_hierarchy_item(
722) -> Result<lsp_types::CallHierarchyItem> { 721) -> Result<lsp_types::CallHierarchyItem> {
723 let name = target.name.to_string(); 722 let name = target.name.to_string();
724 let detail = target.description.clone(); 723 let detail = target.description.clone();
725 let kind = symbol_kind(target.kind); 724 let kind = target.kind.map(symbol_kind).unwrap_or(lsp_types::SymbolKind::Function);
726 let (uri, range, selection_range) = location_info(snap, target)?; 725 let (uri, range, selection_range) = location_info(snap, target)?;
727 Ok(lsp_types::CallHierarchyItem { 726 Ok(lsp_types::CallHierarchyItem {
728 name, 727 name,