aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-30 17:02:20 +0100
committerAleksey Kladov <[email protected]>2020-07-30 17:02:20 +0100
commit3cd4112bdc924c132cb0eab9d064511a215421ec (patch)
treef651b475d9c799a772fd37e89405f80a04ea953e /crates/ra_ide
parent6b25f640a6ad8e2322b5cc0664223b742459336d (diff)
Finalize const&static grammar
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/completion/complete_trait_impl.rs8
-rw-r--r--crates/ra_ide/src/display.rs2
-rw-r--r--crates/ra_ide/src/display/navigation_target.rs8
-rw-r--r--crates/ra_ide/src/display/short_label.rs4
-rw-r--r--crates/ra_ide/src/file_structure.rs8
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs4
6 files changed, 17 insertions, 17 deletions
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 @@
2//! 2//!
3//! This module adds the completion items related to implementing associated 3//! This module adds the completion items related to implementing associated
4//! items within a `impl Trait for Struct` block. The current context node 4//! items within a `impl Trait for Struct` block. The current context node
5//! must be within either a `FN`, `TYPE_ALIAS`, or `CONST_DEF` node 5//! must be within either a `FN`, `TYPE_ALIAS`, or `CONST` node
6//! and an direct child of an `IMPL_DEF`. 6//! and an direct child of an `IMPL_DEF`.
7//! 7//!
8//! # Examples 8//! # Examples
@@ -87,7 +87,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext
87 } 87 }
88 } 88 }
89 89
90 SyntaxKind::CONST_DEF => { 90 SyntaxKind::CONST => {
91 for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def) 91 for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def)
92 .into_iter() 92 .into_iter()
93 .filter_map(|item| match item { 93 .filter_map(|item| match item {
@@ -108,7 +108,7 @@ fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> {
108 let (trigger, impl_def_offset) = ctx.token.ancestors().find_map(|p| match p.kind() { 108 let (trigger, impl_def_offset) = ctx.token.ancestors().find_map(|p| match p.kind() {
109 SyntaxKind::FN 109 SyntaxKind::FN
110 | SyntaxKind::TYPE_ALIAS 110 | SyntaxKind::TYPE_ALIAS
111 | SyntaxKind::CONST_DEF 111 | SyntaxKind::CONST
112 | SyntaxKind::BLOCK_EXPR => Some((p, 2)), 112 | SyntaxKind::BLOCK_EXPR => Some((p, 2)),
113 SyntaxKind::NAME_REF => Some((p, 5)), 113 SyntaxKind::NAME_REF => Some((p, 5)),
114 _ => None, 114 _ => None,
@@ -201,7 +201,7 @@ fn add_const_impl(
201 } 201 }
202} 202}
203 203
204fn make_const_compl_syntax(const_: &ast::ConstDef) -> String { 204fn make_const_compl_syntax(const_: &ast::Const) -> String {
205 let const_ = edit::remove_attrs_and_docs(const_); 205 let const_ = edit::remove_attrs_and_docs(const_);
206 206
207 let const_start = const_.syntax().text_range().start(); 207 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 {
54 buf 54 buf
55} 55}
56 56
57pub(crate) fn const_label(node: &ast::ConstDef) -> String { 57pub(crate) fn const_label(node: &ast::Const) -> String {
58 let label: String = node 58 let label: String = node
59 .syntax() 59 .syntax()
60 .children_with_tokens() 60 .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
385 ast::TraitDef(it) => it.doc_comment_text(), 385 ast::TraitDef(it) => it.doc_comment_text(),
386 ast::Module(it) => it.doc_comment_text(), 386 ast::Module(it) => it.doc_comment_text(),
387 ast::TypeAlias(it) => it.doc_comment_text(), 387 ast::TypeAlias(it) => it.doc_comment_text(),
388 ast::ConstDef(it) => it.doc_comment_text(), 388 ast::Const(it) => it.doc_comment_text(),
389 ast::StaticDef(it) => it.doc_comment_text(), 389 ast::Static(it) => it.doc_comment_text(),
390 ast::RecordField(it) => it.doc_comment_text(), 390 ast::RecordField(it) => it.doc_comment_text(),
391 ast::Variant(it) => it.doc_comment_text(), 391 ast::Variant(it) => it.doc_comment_text(),
392 ast::MacroCall(it) => it.doc_comment_text(), 392 ast::MacroCall(it) => it.doc_comment_text(),
@@ -410,8 +410,8 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) ->
410 ast::TraitDef(it) => it.short_label(), 410 ast::TraitDef(it) => it.short_label(),
411 ast::Module(it) => it.short_label(), 411 ast::Module(it) => it.short_label(),
412 ast::TypeAlias(it) => it.short_label(), 412 ast::TypeAlias(it) => it.short_label(),
413 ast::ConstDef(it) => it.short_label(), 413 ast::Const(it) => it.short_label(),
414 ast::StaticDef(it) => it.short_label(), 414 ast::Static(it) => it.short_label(),
415 ast::RecordField(it) => it.short_label(), 415 ast::RecordField(it) => it.short_label(),
416 ast::Variant(it) => it.short_label(), 416 ast::Variant(it) => it.short_label(),
417 _ => None, 417 _ => 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 {
53 } 53 }
54} 54}
55 55
56impl ShortLabel for ast::ConstDef { 56impl ShortLabel for ast::Const {
57 fn short_label(&self) -> Option<String> { 57 fn short_label(&self) -> Option<String> {
58 short_label_from_ascribed_node(self, "const ") 58 short_label_from_ascribed_node(self, "const ")
59 } 59 }
60} 60}
61 61
62impl ShortLabel for ast::StaticDef { 62impl ShortLabel for ast::Static {
63 fn short_label(&self) -> Option<String> { 63 fn short_label(&self) -> Option<String> {
64 short_label_from_ascribed_node(self, "static ") 64 short_label_from_ascribed_node(self, "static ")
65 } 65 }
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<StructureNode> {
137 decl_with_type_ref(it, ty) 137 decl_with_type_ref(it, ty)
138 }, 138 },
139 ast::RecordField(it) => decl_with_ascription(it), 139 ast::RecordField(it) => decl_with_ascription(it),
140 ast::ConstDef(it) => decl_with_ascription(it), 140 ast::Const(it) => decl_with_ascription(it),
141 ast::StaticDef(it) => decl_with_ascription(it), 141 ast::Static(it) => decl_with_ascription(it),
142 ast::ImplDef(it) => { 142 ast::ImplDef(it) => {
143 let target_type = it.target_type()?; 143 let target_type = it.target_type()?;
144 let target_trait = it.target_trait(); 144 let target_trait = it.target_trait();
@@ -350,7 +350,7 @@ fn very_obsolete() {}
350 label: "S", 350 label: "S",
351 navigation_range: 201..202, 351 navigation_range: 201..202,
352 node_range: 194..213, 352 node_range: 194..213,
353 kind: STATIC_DEF, 353 kind: STATIC,
354 detail: Some( 354 detail: Some(
355 "i32", 355 "i32",
356 ), 356 ),
@@ -361,7 +361,7 @@ fn very_obsolete() {}
361 label: "C", 361 label: "C",
362 navigation_range: 220..221, 362 navigation_range: 220..221,
363 node_range: 214..232, 363 node_range: 214..232,
364 kind: CONST_DEF, 364 kind: CONST,
365 detail: Some( 365 detail: Some(
366 "i32", 366 "i32",
367 ), 367 ),
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 {
714 RECORD_FIELD => HighlightTag::Field, 714 RECORD_FIELD => HighlightTag::Field,
715 MODULE => HighlightTag::Module, 715 MODULE => HighlightTag::Module,
716 FN => HighlightTag::Function, 716 FN => HighlightTag::Function,
717 CONST_DEF => HighlightTag::Constant, 717 CONST => HighlightTag::Constant,
718 STATIC_DEF => HighlightTag::Static, 718 STATIC => HighlightTag::Static,
719 VARIANT => HighlightTag::EnumVariant, 719 VARIANT => HighlightTag::EnumVariant,
720 BIND_PAT => HighlightTag::Local, 720 BIND_PAT => HighlightTag::Local,
721 _ => default, 721 _ => default,