From 1142112c70b705f59b7d559d9d72cdc831865158 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 14:51:08 +0200 Subject: Rename FnDef -> Fn --- crates/ra_ide/src/call_hierarchy.rs | 54 +++++++++++----------- crates/ra_ide/src/completion/complete_fn_param.rs | 10 ++-- crates/ra_ide/src/completion/complete_keyword.rs | 2 +- .../ra_ide/src/completion/complete_trait_impl.rs | 6 +-- crates/ra_ide/src/completion/completion_context.rs | 4 +- crates/ra_ide/src/completion/patterns.rs | 2 +- crates/ra_ide/src/display.rs | 2 +- crates/ra_ide/src/display/navigation_target.rs | 4 +- crates/ra_ide/src/display/short_label.rs | 2 +- crates/ra_ide/src/file_structure.rs | 12 ++--- crates/ra_ide/src/hover.rs | 2 +- crates/ra_ide/src/references.rs | 10 ++-- crates/ra_ide/src/references/rename.rs | 4 +- crates/ra_ide/src/runnables.rs | 40 ++++++++-------- crates/ra_ide/src/syntax_highlighting.rs | 4 +- crates/ra_ide/src/syntax_tree.rs | 14 +++--- 16 files changed, 86 insertions(+), 86 deletions(-) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/call_hierarchy.rs b/crates/ra_ide/src/call_hierarchy.rs index c28af8ab3..1fcaf4a32 100644 --- a/crates/ra_ide/src/call_hierarchy.rs +++ b/crates/ra_ide/src/call_hierarchy.rs @@ -59,7 +59,7 @@ pub(crate) fn incoming_calls(db: &RootDatabase, position: FilePosition) -> Optio if let Some(nav) = syntax.ancestors().find_map(|node| { match_ast! { match node { - ast::FnDef(it) => { + ast::Fn(it) => { let def = sema.to_def(&it)?; Some(def.to_nav(sema.db)) }, @@ -181,8 +181,8 @@ fn caller() { call<|>ee(); } "#, - "callee FN_DEF FileId(1) 0..14 3..9", - &["caller FN_DEF FileId(1) 15..44 18..24 : [33..39]"], + "callee FN FileId(1) 0..14 3..9", + &["caller FN FileId(1) 15..44 18..24 : [33..39]"], &[], ); } @@ -197,8 +197,8 @@ fn caller() { callee(); } "#, - "callee FN_DEF FileId(1) 0..14 3..9", - &["caller FN_DEF FileId(1) 15..44 18..24 : [33..39]"], + "callee FN FileId(1) 0..14 3..9", + &["caller FN FileId(1) 15..44 18..24 : [33..39]"], &[], ); } @@ -214,8 +214,8 @@ fn caller() { callee(); } "#, - "callee FN_DEF FileId(1) 0..14 3..9", - &["caller FN_DEF FileId(1) 15..58 18..24 : [33..39, 47..53]"], + "callee FN FileId(1) 0..14 3..9", + &["caller FN FileId(1) 15..58 18..24 : [33..39, 47..53]"], &[], ); } @@ -234,10 +234,10 @@ fn caller2() { callee(); } "#, - "callee FN_DEF FileId(1) 0..14 3..9", + "callee FN FileId(1) 0..14 3..9", &[ - "caller1 FN_DEF FileId(1) 15..45 18..25 : [34..40]", - "caller2 FN_DEF FileId(1) 47..77 50..57 : [66..72]", + "caller1 FN FileId(1) 15..45 18..25 : [34..40]", + "caller2 FN FileId(1) 47..77 50..57 : [66..72]", ], &[], ); @@ -263,10 +263,10 @@ mod tests { } } "#, - "callee FN_DEF FileId(1) 0..14 3..9", + "callee FN FileId(1) 0..14 3..9", &[ - "caller1 FN_DEF FileId(1) 15..45 18..25 : [34..40]", - "test_caller FN_DEF FileId(1) 95..149 110..121 : [134..140]", + "caller1 FN FileId(1) 15..45 18..25 : [34..40]", + "test_caller FN FileId(1) 95..149 110..121 : [134..140]", ], &[], ); @@ -287,8 +287,8 @@ fn caller() { //- /foo/mod.rs pub fn callee() {} "#, - "callee FN_DEF FileId(2) 0..18 7..13", - &["caller FN_DEF FileId(1) 27..56 30..36 : [45..51]"], + "callee FN FileId(2) 0..18 7..13", + &["caller FN FileId(1) 27..56 30..36 : [45..51]"], &[], ); } @@ -304,9 +304,9 @@ fn call<|>er() { callee(); } "#, - "caller FN_DEF FileId(1) 15..58 18..24", + "caller FN FileId(1) 15..58 18..24", &[], - &["callee FN_DEF FileId(1) 0..14 3..9 : [33..39, 47..53]"], + &["callee FN FileId(1) 0..14 3..9 : [33..39, 47..53]"], ); } @@ -325,9 +325,9 @@ fn call<|>er() { //- /foo/mod.rs pub fn callee() {} "#, - "caller FN_DEF FileId(1) 27..56 30..36", + "caller FN FileId(1) 27..56 30..36", &[], - &["callee FN_DEF FileId(2) 0..18 7..13 : [45..51]"], + &["callee FN FileId(2) 0..18 7..13 : [45..51]"], ); } @@ -348,9 +348,9 @@ fn caller3() { } "#, - "caller2 FN_DEF FileId(1) 33..64 36..43", - &["caller1 FN_DEF FileId(1) 0..31 3..10 : [19..26]"], - &["caller3 FN_DEF FileId(1) 66..83 69..76 : [52..59]"], + "caller2 FN FileId(1) 33..64 36..43", + &["caller1 FN FileId(1) 0..31 3..10 : [19..26]"], + &["caller3 FN FileId(1) 66..83 69..76 : [52..59]"], ); } @@ -368,9 +368,9 @@ fn main() { a<|>() } "#, - "a FN_DEF FileId(1) 0..18 3..4", - &["main FN_DEF FileId(1) 31..52 34..38 : [47..48]"], - &["b FN_DEF FileId(1) 20..29 23..24 : [13..14]"], + "a FN FileId(1) 0..18 3..4", + &["main FN FileId(1) 31..52 34..38 : [47..48]"], + &["b FN FileId(1) 20..29 23..24 : [13..14]"], ); check_hierarchy( @@ -385,8 +385,8 @@ fn main() { a() } "#, - "b FN_DEF FileId(1) 20..29 23..24", - &["a FN_DEF FileId(1) 0..18 3..4 : [13..14]"], + "b FN FileId(1) 20..29 23..24", + &["a FN FileId(1) 0..18 3..4 : [13..14]"], &[], ); } diff --git a/crates/ra_ide/src/completion/complete_fn_param.rs b/crates/ra_ide/src/completion/complete_fn_param.rs index d4b6112a5..406334257 100644 --- a/crates/ra_ide/src/completion/complete_fn_param.rs +++ b/crates/ra_ide/src/completion/complete_fn_param.rs @@ -19,8 +19,8 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext) let mut params = FxHashMap::default(); - let me = ctx.token.ancestors().find_map(ast::FnDef::cast); - let mut process_fn = |func: ast::FnDef| { + let me = ctx.token.ancestors().find_map(ast::Fn::cast); + let mut process_fn = |func: ast::Fn| { if Some(&func) == me.as_ref() { return; } @@ -34,15 +34,15 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext) match_ast! { match node { ast::SourceFile(it) => it.items().filter_map(|item| match item { - ast::Item::FnDef(it) => Some(it), + ast::Item::Fn(it) => Some(it), _ => None, }).for_each(&mut process_fn), ast::ItemList(it) => it.items().filter_map(|item| match item { - ast::Item::FnDef(it) => Some(it), + ast::Item::Fn(it) => Some(it), _ => None, }).for_each(&mut process_fn), ast::AssocItemList(it) => it.assoc_items().filter_map(|item| match item { - ast::AssocItem::FnDef(it) => Some(it), + ast::AssocItem::Fn(it) => Some(it), _ => None, }).for_each(&mut process_fn), _ => continue, diff --git a/crates/ra_ide/src/completion/complete_keyword.rs b/crates/ra_ide/src/completion/complete_keyword.rs index 1581b2d5d..b62064797 100644 --- a/crates/ra_ide/src/completion/complete_keyword.rs +++ b/crates/ra_ide/src/completion/complete_keyword.rs @@ -169,7 +169,7 @@ fn add_keyword(ctx: &CompletionContext, acc: &mut Completions, kw: &str, snippet fn complete_return( ctx: &CompletionContext, - fn_def: &ast::FnDef, + fn_def: &ast::Fn, can_be_stmt: bool, ) -> Option { let snip = match (can_be_stmt, fn_def.ret_type().is_some()) { diff --git a/crates/ra_ide/src/completion/complete_trait_impl.rs b/crates/ra_ide/src/completion/complete_trait_impl.rs index cf716540f..dbb9eecc6 100644 --- a/crates/ra_ide/src/completion/complete_trait_impl.rs +++ b/crates/ra_ide/src/completion/complete_trait_impl.rs @@ -2,7 +2,7 @@ //! //! This module adds the completion items related to implementing associated //! items within a `impl Trait for Struct` block. The current context node -//! must be within either a `FN_DEF`, `TYPE_ALIAS_DEF`, or `CONST_DEF` node +//! must be within either a `FN`, `TYPE_ALIAS_DEF`, or `CONST_DEF` node //! and an direct child of an `IMPL_DEF`. //! //! # Examples @@ -63,7 +63,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext } }), - SyntaxKind::FN_DEF => { + SyntaxKind::FN => { for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def) .into_iter() .filter_map(|item| match item { @@ -106,7 +106,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> { let (trigger, impl_def_offset) = ctx.token.ancestors().find_map(|p| match p.kind() { - SyntaxKind::FN_DEF + SyntaxKind::FN | SyntaxKind::TYPE_ALIAS_DEF | SyntaxKind::CONST_DEF | SyntaxKind::BLOCK_EXPR => Some((p, 2)), diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs index cc55f6dd6..221d7847e 100644 --- a/crates/ra_ide/src/completion/completion_context.rs +++ b/crates/ra_ide/src/completion/completion_context.rs @@ -35,7 +35,7 @@ pub(crate) struct CompletionContext<'a> { pub(super) krate: Option, pub(super) expected_type: Option, pub(super) name_ref_syntax: Option, - pub(super) function_syntax: Option, + pub(super) function_syntax: Option, pub(super) use_item_syntax: Option, pub(super) record_lit_syntax: Option, pub(super) record_pat_syntax: Option, @@ -349,7 +349,7 @@ impl<'a> CompletionContext<'a> { .sema .ancestors_with_macros(self.token.parent()) .take_while(|it| it.kind() != SOURCE_FILE && it.kind() != MODULE) - .find_map(ast::FnDef::cast); + .find_map(ast::Fn::cast); self.record_field_syntax = self .sema diff --git a/crates/ra_ide/src/completion/patterns.rs b/crates/ra_ide/src/completion/patterns.rs index 175209d8a..b8408da4e 100644 --- a/crates/ra_ide/src/completion/patterns.rs +++ b/crates/ra_ide/src/completion/patterns.rs @@ -134,7 +134,7 @@ pub(crate) fn is_in_loop_body(element: SyntaxElement) -> bool { NodeOrToken::Token(token) => token.parent(), }; for node in leaf.ancestors() { - if node.kind() == FN_DEF || node.kind() == LAMBDA_EXPR { + if node.kind() == FN || node.kind() == LAMBDA_EXPR { break; } let loop_body = match_ast! { diff --git a/crates/ra_ide/src/display.rs b/crates/ra_ide/src/display.rs index 6d4151dd8..e4effc66c 100644 --- a/crates/ra_ide/src/display.rs +++ b/crates/ra_ide/src/display.rs @@ -16,7 +16,7 @@ pub use navigation_target::NavigationTarget; pub(crate) use navigation_target::{ToNav, TryToNav}; pub(crate) use short_label::ShortLabel; -pub(crate) fn function_declaration(node: &ast::FnDef) -> String { +pub(crate) fn function_declaration(node: &ast::Fn) -> String { let mut buf = String::new(); if let Some(vis) = node.visibility() { format_to!(buf, "{} ", vis); diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index fd245705c..222cb3502 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs @@ -379,7 +379,7 @@ pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option match_ast! { match node { - ast::FnDef(it) => it.doc_comment_text(), + ast::Fn(it) => it.doc_comment_text(), ast::StructDef(it) => it.doc_comment_text(), ast::EnumDef(it) => it.doc_comment_text(), ast::TraitDef(it) => it.doc_comment_text(), @@ -404,7 +404,7 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> match_ast! { match node { - ast::FnDef(it) => it.short_label(), + ast::Fn(it) => it.short_label(), ast::StructDef(it) => it.short_label(), ast::EnumDef(it) => it.short_label(), ast::TraitDef(it) => it.short_label(), diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs index 5588130a1..63863943a 100644 --- a/crates/ra_ide/src/display/short_label.rs +++ b/crates/ra_ide/src/display/short_label.rs @@ -7,7 +7,7 @@ pub(crate) trait ShortLabel { fn short_label(&self) -> Option; } -impl ShortLabel for ast::FnDef { +impl ShortLabel for ast::Fn { fn short_label(&self) -> Option { Some(crate::display::function_declaration(self)) } diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs index 1f6a3febf..41603480e 100644 --- a/crates/ra_ide/src/file_structure.rs +++ b/crates/ra_ide/src/file_structure.rs @@ -111,7 +111,7 @@ fn structure_node(node: &SyntaxNode) -> Option { match_ast! { match node { - ast::FnDef(it) => { + ast::Fn(it) => { let mut detail = String::from("fn"); if let Some(type_param_list) = it.type_param_list() { collapse_ws(type_param_list.syntax(), &mut detail); @@ -271,7 +271,7 @@ fn very_obsolete() {} label: "bar1", navigation_range: 43..47, node_range: 40..52, - kind: FN_DEF, + kind: FN, detail: Some( "fn()", ), @@ -284,7 +284,7 @@ fn very_obsolete() {} label: "bar2", navigation_range: 60..64, node_range: 57..81, - kind: FN_DEF, + kind: FN, detail: Some( "fn(t: T) -> T", ), @@ -297,7 +297,7 @@ fn very_obsolete() {} label: "bar3", navigation_range: 89..93, node_range: 86..156, - kind: FN_DEF, + kind: FN, detail: Some( "fn(a: A, b: B) -> Vec< u32 >", ), @@ -417,7 +417,7 @@ fn very_obsolete() {} label: "obsolete", navigation_range: 428..436, node_range: 411..441, - kind: FN_DEF, + kind: FN, detail: Some( "fn()", ), @@ -428,7 +428,7 @@ fn very_obsolete() {} label: "very_obsolete", navigation_range: 481..494, node_range: 443..499, - kind: FN_DEF, + kind: FN, detail: Some( "fn()", ), diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index d067c339d..4ef7efd26 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs @@ -1361,7 +1361,7 @@ fn foo_<|>test() {} 11..19, ), name: "foo_test", - kind: FN_DEF, + kind: FN, container_name: None, description: None, docs: None, diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index fe1c074d1..8d3452a83 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs @@ -376,7 +376,7 @@ impl Foo { } "#, ); - check_result(refs, "f FN_DEF FileId(1) 27..43 30..31 Other", &[]); + check_result(refs, "f FN FileId(1) 27..43 30..31 Other", &[]); } #[test] @@ -514,7 +514,7 @@ pub(super) struct Foo<|> { let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); check_result( refs, - "quux FN_DEF FileId(1) 19..35 26..30 Other", + "quux FN FileId(1) 19..35 26..30 Other", &["FileId(2) 16..20 StructLiteral", "FileId(3) 16..20 StructLiteral"], ); @@ -522,7 +522,7 @@ pub(super) struct Foo<|> { analysis.find_all_refs(pos, Some(SearchScope::single_file(bar))).unwrap().unwrap(); check_result( refs, - "quux FN_DEF FileId(1) 19..35 26..30 Other", + "quux FN FileId(1) 19..35 26..30 Other", &["FileId(3) 16..20 StructLiteral"], ); } @@ -619,7 +619,7 @@ fn main() { ); check_result( refs, - "new FN_DEF FileId(1) 54..101 61..64 Other", + "new FN FileId(1) 54..101 61..64 Other", &["FileId(1) 146..149 StructLiteral"], ); } @@ -646,7 +646,7 @@ fn main() { let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); check_result( refs, - "f FN_DEF FileId(1) 26..35 29..30 Other", + "f FN FileId(1) 26..35 29..30 Other", &["FileId(2) 11..12 Other", "FileId(2) 28..29 StructLiteral"], ); } diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs index 8735ec53c..d8ffb8c84 100644 --- a/crates/ra_ide/src/references/rename.rs +++ b/crates/ra_ide/src/references/rename.rs @@ -149,7 +149,7 @@ fn rename_to_self( let source_file = sema.parse(position.file_id); let syn = source_file.syntax(); - let fn_def = find_node_at_offset::(syn, position.offset)?; + let fn_def = find_node_at_offset::(syn, position.offset)?; let params = fn_def.param_list()?; if params.self_param().is_some() { return None; // method already has self param @@ -221,7 +221,7 @@ fn rename_self_to_param( let syn = source_file.syntax(); let text = sema.db.file_text(position.file_id); - let fn_def = find_node_at_offset::(syn, position.offset)?; + let fn_def = find_node_at_offset::(syn, position.offset)?; let search_range = fn_def.syntax().text_range(); let mut edits: Vec = vec![]; diff --git a/crates/ra_ide/src/runnables.rs b/crates/ra_ide/src/runnables.rs index f612835c2..3b7162b84 100644 --- a/crates/ra_ide/src/runnables.rs +++ b/crates/ra_ide/src/runnables.rs @@ -102,7 +102,7 @@ pub(crate) fn runnable( ) -> Option { match_ast! { match item { - ast::FnDef(it) => runnable_fn(sema, it, file_id), + ast::Fn(it) => runnable_fn(sema, it, file_id), ast::Module(it) => runnable_mod(sema, it, file_id), _ => None, } @@ -111,7 +111,7 @@ pub(crate) fn runnable( fn runnable_fn( sema: &Semantics, - fn_def: ast::FnDef, + fn_def: ast::Fn, file_id: FileId, ) -> Option { let name_string = fn_def.name()?.text().to_string(); @@ -188,7 +188,7 @@ pub struct TestAttr { } impl TestAttr { - fn from_fn(fn_def: &ast::FnDef) -> TestAttr { + fn from_fn(fn_def: &ast::Fn) -> TestAttr { let ignore = fn_def .attrs() .filter_map(|attr| attr.simple_name()) @@ -203,7 +203,7 @@ impl TestAttr { /// /// It may produce false positives, for example, `#[wasm_bindgen_test]` requires a different command to run the test, /// but it's better than not to have the runnables for the tests at all. -fn has_test_related_attribute(fn_def: &ast::FnDef) -> bool { +fn has_test_related_attribute(fn_def: &ast::Fn) -> bool { fn_def .attrs() .filter_map(|attr| attr.path()) @@ -211,7 +211,7 @@ fn has_test_related_attribute(fn_def: &ast::FnDef) -> bool { .any(|attribute_text| attribute_text.contains("test")) } -fn has_doc_test(fn_def: &ast::FnDef) -> bool { +fn has_doc_test(fn_def: &ast::Fn) -> bool { fn_def.doc_comment_text().map_or(false, |comment| comment.contains("```")) } @@ -246,7 +246,7 @@ fn has_test_function_or_multiple_test_submodules(module: &ast::Module) -> bool { for item in item_list.items() { match item { - ast::Item::FnDef(f) => { + ast::Item::Fn(f) => { if has_test_related_attribute(&f) { return true; } @@ -320,7 +320,7 @@ fn bench() {} 4..8, ), name: "main", - kind: FN_DEF, + kind: FN, container_name: None, description: None, docs: None, @@ -338,7 +338,7 @@ fn bench() {} 26..34, ), name: "test_foo", - kind: FN_DEF, + kind: FN, container_name: None, description: None, docs: None, @@ -363,7 +363,7 @@ fn bench() {} 62..70, ), name: "test_foo", - kind: FN_DEF, + kind: FN, container_name: None, description: None, docs: None, @@ -388,7 +388,7 @@ fn bench() {} 89..94, ), name: "bench", - kind: FN_DEF, + kind: FN, container_name: None, description: None, docs: None, @@ -431,7 +431,7 @@ fn foo() {} 4..8, ), name: "main", - kind: FN_DEF, + kind: FN, container_name: None, description: None, docs: None, @@ -447,7 +447,7 @@ fn foo() {} full_range: 15..57, focus_range: None, name: "foo", - kind: FN_DEF, + kind: FN, container_name: None, description: None, docs: None, @@ -493,7 +493,7 @@ impl Data { 4..8, ), name: "main", - kind: FN_DEF, + kind: FN, container_name: None, description: None, docs: None, @@ -509,7 +509,7 @@ impl Data { full_range: 44..98, focus_range: None, name: "foo", - kind: FN_DEF, + kind: FN, container_name: None, description: None, docs: None, @@ -570,7 +570,7 @@ mod test_mod { 35..44, ), name: "test_foo1", - kind: FN_DEF, + kind: FN, container_name: None, description: None, docs: None, @@ -670,7 +670,7 @@ mod root_tests { 107..121, ), name: "nested_test_11", - kind: FN_DEF, + kind: FN, container_name: None, description: None, docs: None, @@ -695,7 +695,7 @@ mod root_tests { 163..177, ), name: "nested_test_12", - kind: FN_DEF, + kind: FN, container_name: None, description: None, docs: None, @@ -740,7 +740,7 @@ mod root_tests { 258..271, ), name: "nested_test_2", - kind: FN_DEF, + kind: FN, container_name: None, description: None, docs: None, @@ -783,7 +783,7 @@ fn test_foo1() {} 36..45, ), name: "test_foo1", - kind: FN_DEF, + kind: FN, container_name: None, description: None, docs: None, @@ -831,7 +831,7 @@ fn test_foo1() {} 58..67, ), name: "test_foo1", - kind: FN_DEF, + kind: FN, container_name: None, description: None, docs: None, diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index d456d5d36..5198727d9 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs @@ -464,7 +464,7 @@ fn highlight_element( let db = sema.db; let mut binding_hash = None; let highlight: Highlight = match element.kind() { - FN_DEF => { + FN => { bindings_shadow_count.clear(); return None; } @@ -713,7 +713,7 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight { TYPE_PARAM => HighlightTag::TypeParam, RECORD_FIELD_DEF => HighlightTag::Field, MODULE => HighlightTag::Module, - FN_DEF => HighlightTag::Function, + FN => HighlightTag::Function, CONST_DEF => HighlightTag::Constant, STATIC_DEF => HighlightTag::Static, ENUM_VARIANT => HighlightTag::EnumVariant, diff --git a/crates/ra_ide/src/syntax_tree.rs b/crates/ra_ide/src/syntax_tree.rs index f716a3861..07217e808 100644 --- a/crates/ra_ide/src/syntax_tree.rs +++ b/crates/ra_ide/src/syntax_tree.rs @@ -116,7 +116,7 @@ mod tests { syn.trim(), r#" SOURCE_FILE@0..11 - FN_DEF@0..11 + FN@0..11 FN_KW@0..2 "fn" WHITESPACE@2..3 " " NAME@3..6 @@ -148,7 +148,7 @@ fn test() { syn.trim(), r#" SOURCE_FILE@0..60 - FN_DEF@0..60 + FN@0..60 FN_KW@0..2 "fn" WHITESPACE@2..3 " " NAME@3..7 @@ -190,7 +190,7 @@ SOURCE_FILE@0..60 assert_eq_text!( syn.trim(), r#" -FN_DEF@0..11 +FN@0..11 FN_KW@0..2 "fn" WHITESPACE@2..3 " " NAME@3..6 @@ -258,7 +258,7 @@ fn bar() { syn.trim(), r#" SOURCE_FILE@0..12 - FN_DEF@0..12 + FN@0..12 FN_KW@0..2 "fn" WHITESPACE@2..3 " " NAME@3..6 @@ -292,7 +292,7 @@ fn bar() { syn.trim(), r#" SOURCE_FILE@0..12 - FN_DEF@0..12 + FN@0..12 FN_KW@0..2 "fn" WHITESPACE@2..3 " " NAME@3..6 @@ -325,7 +325,7 @@ fn bar() { syn.trim(), r#" SOURCE_FILE@0..25 - FN_DEF@0..12 + FN@0..12 FN_KW@0..2 "fn" WHITESPACE@2..3 " " NAME@3..6 @@ -339,7 +339,7 @@ SOURCE_FILE@0..25 WHITESPACE@10..11 "\n" R_CURLY@11..12 "}" WHITESPACE@12..13 "\n" - FN_DEF@13..25 + FN@13..25 FN_KW@13..15 "fn" WHITESPACE@15..16 " " NAME@16..19 -- cgit v1.2.3 From eb2f8063444b11257111f4f8ade990ec810e0361 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 15:25:46 +0200 Subject: Rename TypeAliasDef -> TypeAlias --- crates/ra_ide/src/completion/complete_trait_impl.rs | 6 +++--- crates/ra_ide/src/display.rs | 2 +- crates/ra_ide/src/display/navigation_target.rs | 4 ++-- crates/ra_ide/src/display/short_label.rs | 2 +- crates/ra_ide/src/file_structure.rs | 4 ++-- crates/ra_ide/src/syntax_highlighting.rs | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/completion/complete_trait_impl.rs b/crates/ra_ide/src/completion/complete_trait_impl.rs index dbb9eecc6..7d9050a6b 100644 --- a/crates/ra_ide/src/completion/complete_trait_impl.rs +++ b/crates/ra_ide/src/completion/complete_trait_impl.rs @@ -2,7 +2,7 @@ //! //! This module adds the completion items related to implementing associated //! items within a `impl Trait for Struct` block. The current context node -//! must be within either a `FN`, `TYPE_ALIAS_DEF`, or `CONST_DEF` node +//! must be within either a `FN`, `TYPE_ALIAS`, or `CONST_DEF` node //! and an direct child of an `IMPL_DEF`. //! //! # Examples @@ -75,7 +75,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext } } - SyntaxKind::TYPE_ALIAS_DEF => { + SyntaxKind::TYPE_ALIAS => { for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def) .into_iter() .filter_map(|item| match item { @@ -107,7 +107,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> { let (trigger, impl_def_offset) = ctx.token.ancestors().find_map(|p| match p.kind() { SyntaxKind::FN - | SyntaxKind::TYPE_ALIAS_DEF + | SyntaxKind::TYPE_ALIAS | SyntaxKind::CONST_DEF | SyntaxKind::BLOCK_EXPR => Some((p, 2)), SyntaxKind::NAME_REF => Some((p, 5)), diff --git a/crates/ra_ide/src/display.rs b/crates/ra_ide/src/display.rs index e4effc66c..6d93726bf 100644 --- a/crates/ra_ide/src/display.rs +++ b/crates/ra_ide/src/display.rs @@ -65,7 +65,7 @@ pub(crate) fn const_label(node: &ast::ConstDef) -> String { label.trim().to_owned() } -pub(crate) fn type_label(node: &ast::TypeAliasDef) -> String { +pub(crate) fn type_label(node: &ast::TypeAlias) -> String { let label: String = node .syntax() .children_with_tokens() diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index 222cb3502..4f19c7ed4 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs @@ -384,7 +384,7 @@ pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option ast::EnumDef(it) => it.doc_comment_text(), ast::TraitDef(it) => it.doc_comment_text(), ast::Module(it) => it.doc_comment_text(), - ast::TypeAliasDef(it) => it.doc_comment_text(), + ast::TypeAlias(it) => it.doc_comment_text(), ast::ConstDef(it) => it.doc_comment_text(), ast::StaticDef(it) => it.doc_comment_text(), ast::RecordFieldDef(it) => it.doc_comment_text(), @@ -409,7 +409,7 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> ast::EnumDef(it) => it.short_label(), ast::TraitDef(it) => it.short_label(), ast::Module(it) => it.short_label(), - ast::TypeAliasDef(it) => it.short_label(), + ast::TypeAlias(it) => it.short_label(), ast::ConstDef(it) => it.short_label(), ast::StaticDef(it) => it.short_label(), ast::RecordFieldDef(it) => it.short_label(), diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs index 63863943a..e2c95be06 100644 --- a/crates/ra_ide/src/display/short_label.rs +++ b/crates/ra_ide/src/display/short_label.rs @@ -47,7 +47,7 @@ impl ShortLabel for ast::Module { } } -impl ShortLabel for ast::TypeAliasDef { +impl ShortLabel for ast::TypeAlias { fn short_label(&self) -> Option { short_label_from_node(self, "type ") } diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs index 41603480e..8ef977761 100644 --- a/crates/ra_ide/src/file_structure.rs +++ b/crates/ra_ide/src/file_structure.rs @@ -132,7 +132,7 @@ fn structure_node(node: &SyntaxNode) -> Option { ast::EnumVariant(it) => decl(it), ast::TraitDef(it) => decl(it), ast::Module(it) => decl(it), - ast::TypeAliasDef(it) => { + ast::TypeAlias(it) => { let ty = it.type_ref(); decl_with_type_ref(it, ty) }, @@ -339,7 +339,7 @@ fn very_obsolete() {} label: "T", navigation_range: 186..187, node_range: 181..193, - kind: TYPE_ALIAS_DEF, + kind: TYPE_ALIAS, detail: Some( "()", ), diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 5198727d9..8d52fb6e4 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs @@ -709,7 +709,7 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight { ENUM_DEF => HighlightTag::Enum, UNION_DEF => HighlightTag::Union, TRAIT_DEF => HighlightTag::Trait, - TYPE_ALIAS_DEF => HighlightTag::TypeAlias, + TYPE_ALIAS => HighlightTag::TypeAlias, TYPE_PARAM => HighlightTag::TypeParam, RECORD_FIELD_DEF => HighlightTag::Field, MODULE => HighlightTag::Module, -- cgit v1.2.3