aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r--crates/ra_ide/src/completion/complete_trait_impl.rs13
-rw-r--r--crates/ra_ide/src/display.rs2
-rw-r--r--crates/ra_ide/src/display/navigation_target.rs12
-rw-r--r--crates/ra_ide/src/display/short_label.rs6
-rw-r--r--crates/ra_ide/src/extend_selection.rs2
-rw-r--r--crates/ra_ide/src/file_structure.rs14
-rw-r--r--crates/ra_ide/src/folding_ranges.rs2
-rw-r--r--crates/ra_ide/src/references.rs2
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs6
9 files changed, 29 insertions, 30 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..87221d964 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 {
@@ -106,10 +106,9 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext
106 106
107fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> { 107fn 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 | SyntaxKind::TYPE_ALIAS | SyntaxKind::CONST | SyntaxKind::BLOCK_EXPR => {
110 | SyntaxKind::TYPE_ALIAS 110 Some((p, 2))
111 | SyntaxKind::CONST_DEF 111 }
112 | SyntaxKind::BLOCK_EXPR => Some((p, 2)),
113 SyntaxKind::NAME_REF => Some((p, 5)), 112 SyntaxKind::NAME_REF => Some((p, 5)),
114 _ => None, 113 _ => None,
115 })?; 114 })?;
@@ -201,7 +200,7 @@ fn add_const_impl(
201 } 200 }
202} 201}
203 202
204fn make_const_compl_syntax(const_: &ast::ConstDef) -> String { 203fn make_const_compl_syntax(const_: &ast::Const) -> String {
205 let const_ = edit::remove_attrs_and_docs(const_); 204 let const_ = edit::remove_attrs_and_docs(const_);
206 205
207 let const_start = const_.syntax().text_range().start(); 206 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 02fefd6bb..9e2c01245 100644
--- a/crates/ra_ide/src/display/navigation_target.rs
+++ b/crates/ra_ide/src/display/navigation_target.rs
@@ -385,10 +385,10 @@ 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::EnumVariant(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(),
393 _ => None, 393 _ => None,
394 } 394 }
@@ -410,10 +410,10 @@ 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::EnumVariant(it) => it.short_label(), 416 ast::Variant(it) => it.short_label(),
417 _ => None, 417 _ => None,
418 } 418 }
419 } 419 }
diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs
index 5bf70937f..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 }
@@ -71,7 +71,7 @@ impl ShortLabel for ast::RecordField {
71 } 71 }
72} 72}
73 73
74impl ShortLabel for ast::EnumVariant { 74impl ShortLabel for ast::Variant {
75 fn short_label(&self) -> Option<String> { 75 fn short_label(&self) -> Option<String> {
76 Some(self.name()?.text().to_string()) 76 Some(self.name()?.text().to_string())
77 } 77 }
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(
42 RECORD_FIELD_LIST, 42 RECORD_FIELD_LIST,
43 TUPLE_FIELD_LIST, 43 TUPLE_FIELD_LIST,
44 RECORD_EXPR_FIELD_LIST, 44 RECORD_EXPR_FIELD_LIST,
45 ENUM_VARIANT_LIST, 45 VARIANT_LIST,
46 USE_TREE_LIST, 46 USE_TREE_LIST,
47 GENERIC_PARAM_LIST, 47 GENERIC_PARAM_LIST,
48 TYPE_ARG_LIST, 48 TYPE_ARG_LIST,
diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs
index c909f96aa..77384b6ec 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<StructureNode> {
129 ast::Struct(it) => decl(it), 129 ast::Struct(it) => decl(it),
130 ast::Union(it) => decl(it), 130 ast::Union(it) => decl(it),
131 ast::Enum(it) => decl(it), 131 ast::Enum(it) => decl(it),
132 ast::EnumVariant(it) => decl(it), 132 ast::Variant(it) => decl(it),
133 ast::TraitDef(it) => decl(it), 133 ast::TraitDef(it) => decl(it),
134 ast::Module(it) => decl(it), 134 ast::Module(it) => decl(it),
135 ast::TypeAlias(it) => { 135 ast::TypeAlias(it) => {
@@ -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();
@@ -319,7 +319,7 @@ fn very_obsolete() {}
319 label: "X", 319 label: "X",
320 navigation_range: 169..170, 320 navigation_range: 169..170,
321 node_range: 169..170, 321 node_range: 169..170,
322 kind: ENUM_VARIANT, 322 kind: VARIANT,
323 detail: None, 323 detail: None,
324 deprecated: false, 324 deprecated: false,
325 }, 325 },
@@ -330,7 +330,7 @@ fn very_obsolete() {}
330 label: "Y", 330 label: "Y",
331 navigation_range: 172..173, 331 navigation_range: 172..173,
332 node_range: 172..178, 332 node_range: 172..178,
333 kind: ENUM_VARIANT, 333 kind: VARIANT,
334 detail: None, 334 detail: None,
335 deprecated: false, 335 deprecated: false,
336 }, 336 },
@@ -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/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<FoldKind> {
93 | USE_TREE_LIST 93 | USE_TREE_LIST
94 | BLOCK_EXPR 94 | BLOCK_EXPR
95 | MATCH_ARM_LIST 95 | MATCH_ARM_LIST
96 | ENUM_VARIANT_LIST 96 | VARIANT_LIST
97 | TOKEN_TREE => Some(FoldKind::Block), 97 | TOKEN_TREE => Some(FoldKind::Block),
98 _ => None, 98 _ => None,
99 } 99 }
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 {
390} 390}
391"#, 391"#,
392 ); 392 );
393 check_result(refs, "B ENUM_VARIANT FileId(1) 22..23 22..23 Other", &[]); 393 check_result(refs, "B VARIANT FileId(1) 22..23 22..23 Other", &[]);
394 } 394 }
395 395
396 #[test] 396 #[test]
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs
index 7e2833bd5..19ec73d2a 100644
--- a/crates/ra_ide/src/syntax_highlighting.rs
+++ b/crates/ra_ide/src/syntax_highlighting.rs
@@ -714,9 +714,9 @@ 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 ENUM_VARIANT => HighlightTag::EnumVariant, 719 VARIANT => HighlightTag::EnumVariant,
720 BIND_PAT => HighlightTag::Local, 720 BIND_PAT => HighlightTag::Local,
721 _ => default, 721 _ => default,
722 }; 722 };