diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ide/src/display.rs | 1 | ||||
-rw-r--r-- | crates/ide/src/display/navigation_target.rs | 14 |
2 files changed, 8 insertions, 7 deletions
diff --git a/crates/ide/src/display.rs b/crates/ide/src/display.rs index bae9e40df..1f7b665c0 100644 --- a/crates/ide/src/display.rs +++ b/crates/ide/src/display.rs | |||
@@ -5,6 +5,5 @@ pub(crate) mod navigation_target; | |||
5 | mod short_label; | 5 | mod short_label; |
6 | 6 | ||
7 | pub(crate) use navigation_target::{ToNav, TryToNav}; | 7 | pub(crate) use navigation_target::{ToNav, TryToNav}; |
8 | pub(crate) use short_label::ShortLabel; | ||
9 | 8 | ||
10 | pub(crate) use syntax::display::{function_declaration, macro_label}; | 9 | pub(crate) use syntax::display::{function_declaration, macro_label}; |
diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs index 198243466..69c3751a1 100644 --- a/crates/ide/src/display/navigation_target.rs +++ b/crates/ide/src/display/navigation_target.rs | |||
@@ -3,7 +3,9 @@ | |||
3 | use std::fmt; | 3 | use std::fmt; |
4 | 4 | ||
5 | use either::Either; | 5 | use either::Either; |
6 | use hir::{AssocItem, Documentation, FieldSource, HasAttrs, HasSource, InFile, ModuleSource}; | 6 | use hir::{ |
7 | AssocItem, Documentation, FieldSource, HasAttrs, HasSource, HirDisplay, InFile, ModuleSource, | ||
8 | }; | ||
7 | use ide_db::{ | 9 | use ide_db::{ |
8 | base_db::{FileId, FileRange, SourceDatabase}, | 10 | base_db::{FileId, FileRange, SourceDatabase}, |
9 | symbol_index::FileSymbolKind, | 11 | symbol_index::FileSymbolKind, |
@@ -98,7 +100,7 @@ impl NavigationTarget { | |||
98 | SymbolKind::Module, | 100 | SymbolKind::Module, |
99 | ); | 101 | ); |
100 | res.docs = module.attrs(db).docs(); | 102 | res.docs = module.attrs(db).docs(); |
101 | res.description = src.value.short_label(); | 103 | res.description = Some(module.display(db).to_string()); |
102 | return res; | 104 | return res; |
103 | } | 105 | } |
104 | module.to_nav(db) | 106 | module.to_nav(db) |
@@ -251,8 +253,8 @@ impl ToNavFromAst for hir::Trait { | |||
251 | 253 | ||
252 | impl<D> TryToNav for D | 254 | impl<D> TryToNav for D |
253 | where | 255 | where |
254 | D: HasSource + ToNavFromAst + Copy + HasAttrs, | 256 | D: HasSource + ToNavFromAst + Copy + HasAttrs + HirDisplay, |
255 | D::Ast: ast::NameOwner + ShortLabel, | 257 | D::Ast: ast::NameOwner, |
256 | { | 258 | { |
257 | fn try_to_nav(&self, db: &RootDatabase) -> Option<NavigationTarget> { | 259 | fn try_to_nav(&self, db: &RootDatabase) -> Option<NavigationTarget> { |
258 | let src = self.source(db)?; | 260 | let src = self.source(db)?; |
@@ -262,7 +264,7 @@ where | |||
262 | D::KIND, | 264 | D::KIND, |
263 | ); | 265 | ); |
264 | res.docs = self.docs(db); | 266 | res.docs = self.docs(db); |
265 | res.description = src.value.short_label(); | 267 | res.description = Some(self.display(db).to_string()); |
266 | Some(res) | 268 | Some(res) |
267 | } | 269 | } |
268 | } | 270 | } |
@@ -317,7 +319,7 @@ impl TryToNav for hir::Field { | |||
317 | let mut res = | 319 | let mut res = |
318 | NavigationTarget::from_named(db, src.with_value(it), SymbolKind::Field); | 320 | NavigationTarget::from_named(db, src.with_value(it), SymbolKind::Field); |
319 | res.docs = self.docs(db); | 321 | res.docs = self.docs(db); |
320 | res.description = it.short_label(); | 322 | res.description = Some(self.display(db).to_string()); |
321 | res | 323 | res |
322 | } | 324 | } |
323 | FieldSource::Pos(it) => { | 325 | FieldSource::Pos(it) => { |