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