From 36e3fc9d5413f7e6e17e82867aae1318645880a3 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 20 Nov 2019 09:40:36 +0300 Subject: Rename Source::ast -> Source::value --- crates/ra_ide_api/src/hover.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'crates/ra_ide_api/src/hover.rs') diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs index 787b714b3..e8a340ba4 100644 --- a/crates/ra_ide_api/src/hover.rs +++ b/crates/ra_ide_api/src/hover.rs @@ -101,11 +101,11 @@ fn hover_text_from_name_kind( return match name_kind { Macro(it) => { let src = it.source(db); - hover_text(src.ast.doc_comment_text(), Some(macro_label(&src.ast))) + hover_text(src.value.doc_comment_text(), Some(macro_label(&src.value))) } Field(it) => { let src = it.source(db); - match src.ast { + match src.value { hir::FieldSource::Named(it) => hover_text(it.doc_comment_text(), it.short_label()), _ => None, } @@ -116,7 +116,7 @@ fn hover_text_from_name_kind( hir::AssocItem::TypeAlias(it) => from_def_source(db, it), }, Def(it) => match it { - hir::ModuleDef::Module(it) => match it.definition_source(db).ast { + hir::ModuleDef::Module(it) => match it.definition_source(db).value { hir::ModuleSource::Module(it) => { hover_text(it.doc_comment_text(), it.short_label()) } @@ -158,7 +158,7 @@ fn hover_text_from_name_kind( A: ast::DocCommentsOwner + ast::NameOwner + ShortLabel, { let src = def.source(db); - hover_text(src.ast.doc_comment_text(), src.ast.short_label()) + hover_text(src.value.doc_comment_text(), src.value.short_label()) } } @@ -170,7 +170,7 @@ pub(crate) fn hover(db: &RootDatabase, position: FilePosition) -> Option { let mut no_fallback = false; if let Some(name_kind) = @@ -211,7 +211,7 @@ pub(crate) fn hover(db: &RootDatabase, position: FilePosition) -> Option Date: Wed, 20 Nov 2019 13:09:21 +0300 Subject: Rename with_ast -> with_value --- crates/ra_ide_api/src/hover.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_ide_api/src/hover.rs') diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs index e8a340ba4..ae87ab9f9 100644 --- a/crates/ra_ide_api/src/hover.rs +++ b/crates/ra_ide_api/src/hover.rs @@ -174,7 +174,7 @@ pub(crate) fn hover(db: &RootDatabase, position: FilePosition) -> Option { let mut no_fallback = false; if let Some(name_kind) = - classify_name_ref(db, token.with_ast(&name_ref)).map(|d| d.kind) + classify_name_ref(db, token.with_value(&name_ref)).map(|d| d.kind) { res.extend(hover_text_from_name_kind(db, name_kind, &mut no_fallback)) } @@ -196,7 +196,7 @@ pub(crate) fn hover(db: &RootDatabase, position: FilePosition) -> Option { - if let Some(name_kind) = classify_name(db, token.with_ast(&name)).map(|d| d.kind) { + if let Some(name_kind) = classify_name(db, token.with_value(&name)).map(|d| d.kind) { res.extend(hover_text_from_name_kind(db, name_kind, &mut true)); } -- cgit v1.2.3 From 111891dc2dc1d2c7ea87144e8e3ddefe23fc7b6d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 20 Nov 2019 18:00:01 +0300 Subject: Move constants to new ID This allows us to get rid of trait item index --- crates/ra_ide_api/src/hover.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'crates/ra_ide_api/src/hover.rs') diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs index ae87ab9f9..9839be985 100644 --- a/crates/ra_ide_api/src/hover.rs +++ b/crates/ra_ide_api/src/hover.rs @@ -404,9 +404,7 @@ mod tests { check_hover_result( r#" //- /main.rs - fn main() { - const foo<|>: u32 = 0; - } + const foo<|>: u32 = 0; "#, &["const foo: u32"], ); @@ -414,9 +412,7 @@ mod tests { check_hover_result( r#" //- /main.rs - fn main() { - static foo<|>: u32 = 0; - } + static foo<|>: u32 = 0; "#, &["static foo: u32"], ); -- cgit v1.2.3