From 1766aae145c6925a33e427f2fe6ef2a56c301665 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 17:56:53 +0200 Subject: Rename EnumVariant -> Variant --- crates/ra_ide/src/display/navigation_target.rs | 4 ++-- crates/ra_ide/src/display/short_label.rs | 2 +- crates/ra_ide/src/extend_selection.rs | 2 +- crates/ra_ide/src/file_structure.rs | 6 +++--- crates/ra_ide/src/folding_ranges.rs | 2 +- crates/ra_ide/src/references.rs | 2 +- crates/ra_ide/src/syntax_highlighting.rs | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index 02fefd6bb..c30b91fe0 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs @@ -388,7 +388,7 @@ pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option ast::ConstDef(it) => it.doc_comment_text(), ast::StaticDef(it) => it.doc_comment_text(), ast::RecordField(it) => it.doc_comment_text(), - ast::EnumVariant(it) => it.doc_comment_text(), + ast::Variant(it) => it.doc_comment_text(), ast::MacroCall(it) => it.doc_comment_text(), _ => None, } @@ -413,7 +413,7 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> ast::ConstDef(it) => it.short_label(), ast::StaticDef(it) => it.short_label(), ast::RecordField(it) => it.short_label(), - ast::EnumVariant(it) => it.short_label(), + ast::Variant(it) => it.short_label(), _ => None, } } diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs index 5bf70937f..ddf1059ee 100644 --- a/crates/ra_ide/src/display/short_label.rs +++ b/crates/ra_ide/src/display/short_label.rs @@ -71,7 +71,7 @@ impl ShortLabel for ast::RecordField { } } -impl ShortLabel for ast::EnumVariant { +impl ShortLabel for ast::Variant { fn short_label(&self) -> Option { Some(self.name()?.text().to_string()) } diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs index 04a7f0ac4..fc81b48cc 100644 --- a/crates/ra_ide/src/extend_selection.rs +++ b/crates/ra_ide/src/extend_selection.rs @@ -42,7 +42,7 @@ fn try_extend_selection( RECORD_FIELD_LIST, TUPLE_FIELD_LIST, RECORD_EXPR_FIELD_LIST, - ENUM_VARIANT_LIST, + VARIANT_LIST, USE_TREE_LIST, GENERIC_PARAM_LIST, TYPE_ARG_LIST, diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs index c909f96aa..43202499d 100644 --- a/crates/ra_ide/src/file_structure.rs +++ b/crates/ra_ide/src/file_structure.rs @@ -129,7 +129,7 @@ fn structure_node(node: &SyntaxNode) -> Option { ast::Struct(it) => decl(it), ast::Union(it) => decl(it), ast::Enum(it) => decl(it), - ast::EnumVariant(it) => decl(it), + ast::Variant(it) => decl(it), ast::TraitDef(it) => decl(it), ast::Module(it) => decl(it), ast::TypeAlias(it) => { @@ -319,7 +319,7 @@ fn very_obsolete() {} label: "X", navigation_range: 169..170, node_range: 169..170, - kind: ENUM_VARIANT, + kind: VARIANT, detail: None, deprecated: false, }, @@ -330,7 +330,7 @@ fn very_obsolete() {} label: "Y", navigation_range: 172..173, node_range: 172..178, - kind: ENUM_VARIANT, + kind: VARIANT, detail: None, deprecated: false, }, diff --git a/crates/ra_ide/src/folding_ranges.rs b/crates/ra_ide/src/folding_ranges.rs index 8dcce9f56..5a6e17936 100644 --- a/crates/ra_ide/src/folding_ranges.rs +++ b/crates/ra_ide/src/folding_ranges.rs @@ -93,7 +93,7 @@ fn fold_kind(kind: SyntaxKind) -> Option { | USE_TREE_LIST | BLOCK_EXPR | MATCH_ARM_LIST - | ENUM_VARIANT_LIST + | VARIANT_LIST | TOKEN_TREE => Some(FoldKind::Block), _ => None, } diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index 2a62dab6c..519e4bf1a 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs @@ -390,7 +390,7 @@ enum Foo { } "#, ); - check_result(refs, "B ENUM_VARIANT FileId(1) 22..23 22..23 Other", &[]); + check_result(refs, "B VARIANT FileId(1) 22..23 22..23 Other", &[]); } #[test] diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 7e2833bd5..ce890c816 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs @@ -716,7 +716,7 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight { FN => HighlightTag::Function, CONST_DEF => HighlightTag::Constant, STATIC_DEF => HighlightTag::Static, - ENUM_VARIANT => HighlightTag::EnumVariant, + VARIANT => HighlightTag::EnumVariant, BIND_PAT => HighlightTag::Local, _ => default, }; -- cgit v1.2.3 From 3cd4112bdc924c132cb0eab9d064511a215421ec Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 18:02:20 +0200 Subject: Finalize const&static grammar --- crates/ra_ide/src/completion/complete_trait_impl.rs | 8 ++++---- crates/ra_ide/src/display.rs | 2 +- crates/ra_ide/src/display/navigation_target.rs | 8 ++++---- crates/ra_ide/src/display/short_label.rs | 4 ++-- crates/ra_ide/src/file_structure.rs | 8 ++++---- crates/ra_ide/src/syntax_highlighting.rs | 4 ++-- 6 files changed, 17 insertions(+), 17 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 7d9050a6b..88679f3bd 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`, or `CONST_DEF` node +//! must be within either a `FN`, `TYPE_ALIAS`, or `CONST` node //! and an direct child of an `IMPL_DEF`. //! //! # Examples @@ -87,7 +87,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext } } - SyntaxKind::CONST_DEF => { + SyntaxKind::CONST => { for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def) .into_iter() .filter_map(|item| match item { @@ -108,7 +108,7 @@ 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 - | SyntaxKind::CONST_DEF + | SyntaxKind::CONST | SyntaxKind::BLOCK_EXPR => Some((p, 2)), SyntaxKind::NAME_REF => Some((p, 5)), _ => None, @@ -201,7 +201,7 @@ fn add_const_impl( } } -fn make_const_compl_syntax(const_: &ast::ConstDef) -> String { +fn make_const_compl_syntax(const_: &ast::Const) -> String { let const_ = edit::remove_attrs_and_docs(const_); let const_start = const_.syntax().text_range().start(); diff --git a/crates/ra_ide/src/display.rs b/crates/ra_ide/src/display.rs index e81e8436f..3efca0649 100644 --- a/crates/ra_ide/src/display.rs +++ b/crates/ra_ide/src/display.rs @@ -54,7 +54,7 @@ pub(crate) fn function_declaration(node: &ast::Fn) -> String { buf } -pub(crate) fn const_label(node: &ast::ConstDef) -> String { +pub(crate) fn const_label(node: &ast::Const) -> 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 c30b91fe0..9e2c01245 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs @@ -385,8 +385,8 @@ pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option ast::TraitDef(it) => it.doc_comment_text(), ast::Module(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::Const(it) => it.doc_comment_text(), + ast::Static(it) => it.doc_comment_text(), ast::RecordField(it) => it.doc_comment_text(), ast::Variant(it) => it.doc_comment_text(), ast::MacroCall(it) => it.doc_comment_text(), @@ -410,8 +410,8 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> ast::TraitDef(it) => it.short_label(), ast::Module(it) => it.short_label(), ast::TypeAlias(it) => it.short_label(), - ast::ConstDef(it) => it.short_label(), - ast::StaticDef(it) => it.short_label(), + ast::Const(it) => it.short_label(), + ast::Static(it) => it.short_label(), ast::RecordField(it) => it.short_label(), ast::Variant(it) => it.short_label(), _ => None, diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs index ddf1059ee..282f362f2 100644 --- a/crates/ra_ide/src/display/short_label.rs +++ b/crates/ra_ide/src/display/short_label.rs @@ -53,13 +53,13 @@ impl ShortLabel for ast::TypeAlias { } } -impl ShortLabel for ast::ConstDef { +impl ShortLabel for ast::Const { fn short_label(&self) -> Option { short_label_from_ascribed_node(self, "const ") } } -impl ShortLabel for ast::StaticDef { +impl ShortLabel for ast::Static { fn short_label(&self) -> Option { short_label_from_ascribed_node(self, "static ") } diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs index 43202499d..77384b6ec 100644 --- a/crates/ra_ide/src/file_structure.rs +++ b/crates/ra_ide/src/file_structure.rs @@ -137,8 +137,8 @@ fn structure_node(node: &SyntaxNode) -> Option { decl_with_type_ref(it, ty) }, ast::RecordField(it) => decl_with_ascription(it), - ast::ConstDef(it) => decl_with_ascription(it), - ast::StaticDef(it) => decl_with_ascription(it), + ast::Const(it) => decl_with_ascription(it), + ast::Static(it) => decl_with_ascription(it), ast::ImplDef(it) => { let target_type = it.target_type()?; let target_trait = it.target_trait(); @@ -350,7 +350,7 @@ fn very_obsolete() {} label: "S", navigation_range: 201..202, node_range: 194..213, - kind: STATIC_DEF, + kind: STATIC, detail: Some( "i32", ), @@ -361,7 +361,7 @@ fn very_obsolete() {} label: "C", navigation_range: 220..221, node_range: 214..232, - kind: CONST_DEF, + kind: CONST, detail: Some( "i32", ), diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index ce890c816..19ec73d2a 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs @@ -714,8 +714,8 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight { RECORD_FIELD => HighlightTag::Field, MODULE => HighlightTag::Module, FN => HighlightTag::Function, - CONST_DEF => HighlightTag::Constant, - STATIC_DEF => HighlightTag::Static, + CONST => HighlightTag::Constant, + STATIC => HighlightTag::Static, VARIANT => HighlightTag::EnumVariant, BIND_PAT => HighlightTag::Local, _ => default, -- cgit v1.2.3 From ba71f05438a93991aff6970488a720c90774d35b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 18:10:07 +0200 Subject: fmt --- crates/ra_ide/src/completion/complete_trait_impl.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 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 88679f3bd..87221d964 100644 --- a/crates/ra_ide/src/completion/complete_trait_impl.rs +++ b/crates/ra_ide/src/completion/complete_trait_impl.rs @@ -106,10 +106,9 @@ 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 - | SyntaxKind::CONST - | SyntaxKind::BLOCK_EXPR => Some((p, 2)), + SyntaxKind::FN | SyntaxKind::TYPE_ALIAS | SyntaxKind::CONST | SyntaxKind::BLOCK_EXPR => { + Some((p, 2)) + } SyntaxKind::NAME_REF => Some((p, 5)), _ => None, })?; -- cgit v1.2.3