diff options
Diffstat (limited to 'crates/ra_ide')
-rw-r--r-- | crates/ra_ide/src/completion/complete_trait_impl.rs | 8 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/completion_context.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/patterns.rs | 8 | ||||
-rw-r--r-- | crates/ra_ide/src/display/navigation_target.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/display/short_label.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/file_structure.rs | 8 | ||||
-rw-r--r-- | crates/ra_ide/src/goto_implementation.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/hover.rs | 32 | ||||
-rw-r--r-- | crates/ra_ide/src/references/rename.rs | 5 | ||||
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting.rs | 4 |
10 files changed, 39 insertions, 40 deletions
diff --git a/crates/ra_ide/src/completion/complete_trait_impl.rs b/crates/ra_ide/src/completion/complete_trait_impl.rs index 87221d964..d9a0ef167 100644 --- a/crates/ra_ide/src/completion/complete_trait_impl.rs +++ b/crates/ra_ide/src/completion/complete_trait_impl.rs | |||
@@ -3,7 +3,7 @@ | |||
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` 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`. |
7 | //! | 7 | //! |
8 | //! # Examples | 8 | //! # Examples |
9 | //! | 9 | //! |
@@ -34,7 +34,7 @@ | |||
34 | use hir::{self, Docs, HasSource}; | 34 | use hir::{self, Docs, HasSource}; |
35 | use ra_assists::utils::get_missing_assoc_items; | 35 | use ra_assists::utils::get_missing_assoc_items; |
36 | use ra_syntax::{ | 36 | use ra_syntax::{ |
37 | ast::{self, edit, ImplDef}, | 37 | ast::{self, edit, Impl}, |
38 | AstNode, SyntaxKind, SyntaxNode, TextRange, T, | 38 | AstNode, SyntaxKind, SyntaxNode, TextRange, T, |
39 | }; | 39 | }; |
40 | use ra_text_edit::TextEdit; | 40 | use ra_text_edit::TextEdit; |
@@ -104,7 +104,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext | |||
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
107 | fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> { | 107 | fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, Impl)> { |
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 | SyntaxKind::TYPE_ALIAS | SyntaxKind::CONST | SyntaxKind::BLOCK_EXPR => { | 109 | SyntaxKind::FN | SyntaxKind::TYPE_ALIAS | SyntaxKind::CONST | SyntaxKind::BLOCK_EXPR => { |
110 | Some((p, 2)) | 110 | Some((p, 2)) |
@@ -114,7 +114,7 @@ fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> { | |||
114 | })?; | 114 | })?; |
115 | let impl_def = (0..impl_def_offset - 1) | 115 | let impl_def = (0..impl_def_offset - 1) |
116 | .try_fold(trigger.parent()?, |t, _| t.parent()) | 116 | .try_fold(trigger.parent()?, |t, _| t.parent()) |
117 | .and_then(ast::ImplDef::cast)?; | 117 | .and_then(ast::Impl::cast)?; |
118 | Some((trigger, impl_def)) | 118 | Some((trigger, impl_def)) |
119 | } | 119 | } |
120 | 120 | ||
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs index c8704eb3e..2113abbb2 100644 --- a/crates/ra_ide/src/completion/completion_context.rs +++ b/crates/ra_ide/src/completion/completion_context.rs | |||
@@ -40,7 +40,7 @@ pub(crate) struct CompletionContext<'a> { | |||
40 | pub(super) record_lit_syntax: Option<ast::RecordExpr>, | 40 | pub(super) record_lit_syntax: Option<ast::RecordExpr>, |
41 | pub(super) record_pat_syntax: Option<ast::RecordPat>, | 41 | pub(super) record_pat_syntax: Option<ast::RecordPat>, |
42 | pub(super) record_field_syntax: Option<ast::RecordExprField>, | 42 | pub(super) record_field_syntax: Option<ast::RecordExprField>, |
43 | pub(super) impl_def: Option<ast::ImplDef>, | 43 | pub(super) impl_def: Option<ast::Impl>, |
44 | /// FIXME: `ActiveParameter` is string-based, which is very very wrong | 44 | /// FIXME: `ActiveParameter` is string-based, which is very very wrong |
45 | pub(super) active_parameter: Option<ActiveParameter>, | 45 | pub(super) active_parameter: Option<ActiveParameter>, |
46 | pub(super) is_param: bool, | 46 | pub(super) is_param: bool, |
@@ -325,7 +325,7 @@ impl<'a> CompletionContext<'a> { | |||
325 | .sema | 325 | .sema |
326 | .ancestors_with_macros(self.token.parent()) | 326 | .ancestors_with_macros(self.token.parent()) |
327 | .take_while(|it| it.kind() != SOURCE_FILE && it.kind() != MODULE) | 327 | .take_while(|it| it.kind() != SOURCE_FILE && it.kind() != MODULE) |
328 | .find_map(ast::ImplDef::cast); | 328 | .find_map(ast::Impl::cast); |
329 | 329 | ||
330 | let top_node = name_ref | 330 | let top_node = name_ref |
331 | .syntax() | 331 | .syntax() |
diff --git a/crates/ra_ide/src/completion/patterns.rs b/crates/ra_ide/src/completion/patterns.rs index b8408da4e..a68861e1c 100644 --- a/crates/ra_ide/src/completion/patterns.rs +++ b/crates/ra_ide/src/completion/patterns.rs | |||
@@ -15,7 +15,7 @@ pub(crate) fn has_trait_parent(element: SyntaxElement) -> bool { | |||
15 | not_same_range_ancestor(element) | 15 | not_same_range_ancestor(element) |
16 | .filter(|it| it.kind() == ASSOC_ITEM_LIST) | 16 | .filter(|it| it.kind() == ASSOC_ITEM_LIST) |
17 | .and_then(|it| it.parent()) | 17 | .and_then(|it| it.parent()) |
18 | .filter(|it| it.kind() == TRAIT_DEF) | 18 | .filter(|it| it.kind() == TRAIT) |
19 | .is_some() | 19 | .is_some() |
20 | } | 20 | } |
21 | #[test] | 21 | #[test] |
@@ -27,7 +27,7 @@ pub(crate) fn has_impl_parent(element: SyntaxElement) -> bool { | |||
27 | not_same_range_ancestor(element) | 27 | not_same_range_ancestor(element) |
28 | .filter(|it| it.kind() == ASSOC_ITEM_LIST) | 28 | .filter(|it| it.kind() == ASSOC_ITEM_LIST) |
29 | .and_then(|it| it.parent()) | 29 | .and_then(|it| it.parent()) |
30 | .filter(|it| it.kind() == IMPL_DEF) | 30 | .filter(|it| it.kind() == IMPL) |
31 | .is_some() | 31 | .is_some() |
32 | } | 32 | } |
33 | #[test] | 33 | #[test] |
@@ -113,7 +113,7 @@ fn test_if_is_prev() { | |||
113 | } | 113 | } |
114 | 114 | ||
115 | pub(crate) fn has_trait_as_prev_sibling(element: SyntaxElement) -> bool { | 115 | pub(crate) fn has_trait_as_prev_sibling(element: SyntaxElement) -> bool { |
116 | previous_sibling_or_ancestor_sibling(element).filter(|it| it.kind() == TRAIT_DEF).is_some() | 116 | previous_sibling_or_ancestor_sibling(element).filter(|it| it.kind() == TRAIT).is_some() |
117 | } | 117 | } |
118 | #[test] | 118 | #[test] |
119 | fn test_has_trait_as_prev_sibling() { | 119 | fn test_has_trait_as_prev_sibling() { |
@@ -121,7 +121,7 @@ fn test_has_trait_as_prev_sibling() { | |||
121 | } | 121 | } |
122 | 122 | ||
123 | pub(crate) fn has_impl_as_prev_sibling(element: SyntaxElement) -> bool { | 123 | pub(crate) fn has_impl_as_prev_sibling(element: SyntaxElement) -> bool { |
124 | previous_sibling_or_ancestor_sibling(element).filter(|it| it.kind() == IMPL_DEF).is_some() | 124 | previous_sibling_or_ancestor_sibling(element).filter(|it| it.kind() == IMPL).is_some() |
125 | } | 125 | } |
126 | #[test] | 126 | #[test] |
127 | fn test_has_impl_as_prev_sibling() { | 127 | fn test_has_impl_as_prev_sibling() { |
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index 9e2c01245..45fbc86ef 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs | |||
@@ -382,7 +382,7 @@ pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option | |||
382 | ast::Fn(it) => it.doc_comment_text(), | 382 | ast::Fn(it) => it.doc_comment_text(), |
383 | ast::Struct(it) => it.doc_comment_text(), | 383 | ast::Struct(it) => it.doc_comment_text(), |
384 | ast::Enum(it) => it.doc_comment_text(), | 384 | ast::Enum(it) => it.doc_comment_text(), |
385 | ast::TraitDef(it) => it.doc_comment_text(), | 385 | ast::Trait(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::Const(it) => it.doc_comment_text(), | 388 | ast::Const(it) => it.doc_comment_text(), |
@@ -407,7 +407,7 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> | |||
407 | ast::Fn(it) => it.short_label(), | 407 | ast::Fn(it) => it.short_label(), |
408 | ast::Struct(it) => it.short_label(), | 408 | ast::Struct(it) => it.short_label(), |
409 | ast::Enum(it) => it.short_label(), | 409 | ast::Enum(it) => it.short_label(), |
410 | ast::TraitDef(it) => it.short_label(), | 410 | ast::Trait(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::Const(it) => it.short_label(), | 413 | ast::Const(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 282f362f2..c600908a4 100644 --- a/crates/ra_ide/src/display/short_label.rs +++ b/crates/ra_ide/src/display/short_label.rs | |||
@@ -31,7 +31,7 @@ impl ShortLabel for ast::Enum { | |||
31 | } | 31 | } |
32 | } | 32 | } |
33 | 33 | ||
34 | impl ShortLabel for ast::TraitDef { | 34 | impl ShortLabel for ast::Trait { |
35 | fn short_label(&self) -> Option<String> { | 35 | fn short_label(&self) -> Option<String> { |
36 | if self.unsafe_token().is_some() { | 36 | if self.unsafe_token().is_some() { |
37 | short_label_from_node(self, "unsafe trait ") | 37 | short_label_from_node(self, "unsafe trait ") |
diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs index 77384b6ec..7d378f2d0 100644 --- a/crates/ra_ide/src/file_structure.rs +++ b/crates/ra_ide/src/file_structure.rs | |||
@@ -130,7 +130,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> { | |||
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::Variant(it) => decl(it), | 132 | ast::Variant(it) => decl(it), |
133 | ast::TraitDef(it) => decl(it), | 133 | ast::Trait(it) => decl(it), |
134 | ast::Module(it) => decl(it), | 134 | ast::Module(it) => decl(it), |
135 | ast::TypeAlias(it) => { | 135 | ast::TypeAlias(it) => { |
136 | let ty = it.type_ref(); | 136 | let ty = it.type_ref(); |
@@ -139,7 +139,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> { | |||
139 | ast::RecordField(it) => decl_with_ascription(it), | 139 | ast::RecordField(it) => decl_with_ascription(it), |
140 | ast::Const(it) => decl_with_ascription(it), | 140 | ast::Const(it) => decl_with_ascription(it), |
141 | ast::Static(it) => decl_with_ascription(it), | 141 | ast::Static(it) => decl_with_ascription(it), |
142 | ast::ImplDef(it) => { | 142 | ast::Impl(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(); |
145 | let label = match target_trait { | 145 | let label = match target_trait { |
@@ -372,7 +372,7 @@ fn very_obsolete() {} | |||
372 | label: "impl E", | 372 | label: "impl E", |
373 | navigation_range: 239..240, | 373 | navigation_range: 239..240, |
374 | node_range: 234..243, | 374 | node_range: 234..243, |
375 | kind: IMPL_DEF, | 375 | kind: IMPL, |
376 | detail: None, | 376 | detail: None, |
377 | deprecated: false, | 377 | deprecated: false, |
378 | }, | 378 | }, |
@@ -381,7 +381,7 @@ fn very_obsolete() {} | |||
381 | label: "impl fmt::Debug for E", | 381 | label: "impl fmt::Debug for E", |
382 | navigation_range: 265..266, | 382 | navigation_range: 265..266, |
383 | node_range: 245..269, | 383 | node_range: 245..269, |
384 | kind: IMPL_DEF, | 384 | kind: IMPL, |
385 | detail: None, | 385 | detail: None, |
386 | deprecated: false, | 386 | deprecated: false, |
387 | }, | 387 | }, |
diff --git a/crates/ra_ide/src/goto_implementation.rs b/crates/ra_ide/src/goto_implementation.rs index e2f7e6373..9912b7142 100644 --- a/crates/ra_ide/src/goto_implementation.rs +++ b/crates/ra_ide/src/goto_implementation.rs | |||
@@ -28,7 +28,7 @@ pub(crate) fn goto_implementation( | |||
28 | nominal_def.syntax().text_range(), | 28 | nominal_def.syntax().text_range(), |
29 | impls_for_def(&sema, &nominal_def, krate)?, | 29 | impls_for_def(&sema, &nominal_def, krate)?, |
30 | )); | 30 | )); |
31 | } else if let Some(trait_def) = find_node_at_offset::<ast::TraitDef>(&syntax, position.offset) { | 31 | } else if let Some(trait_def) = find_node_at_offset::<ast::Trait>(&syntax, position.offset) { |
32 | return Some(RangeInfo::new( | 32 | return Some(RangeInfo::new( |
33 | trait_def.syntax().text_range(), | 33 | trait_def.syntax().text_range(), |
34 | impls_for_trait(&sema, &trait_def, krate)?, | 34 | impls_for_trait(&sema, &trait_def, krate)?, |
@@ -62,7 +62,7 @@ fn impls_for_def( | |||
62 | 62 | ||
63 | fn impls_for_trait( | 63 | fn impls_for_trait( |
64 | sema: &Semantics<RootDatabase>, | 64 | sema: &Semantics<RootDatabase>, |
65 | node: &ast::TraitDef, | 65 | node: &ast::Trait, |
66 | krate: Crate, | 66 | krate: Crate, |
67 | ) -> Option<Vec<NavigationTarget>> { | 67 | ) -> Option<Vec<NavigationTarget>> { |
68 | let tr = sema.to_def(node)?; | 68 | let tr = sema.to_def(node)?; |
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index 83228af2e..aa48cb412 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs | |||
@@ -1678,7 +1678,7 @@ fn main() { let s<|>t = foo(); } | |||
1678 | 6..9, | 1678 | 6..9, |
1679 | ), | 1679 | ), |
1680 | name: "Foo", | 1680 | name: "Foo", |
1681 | kind: TRAIT_DEF, | 1681 | kind: TRAIT, |
1682 | container_name: None, | 1682 | container_name: None, |
1683 | description: Some( | 1683 | description: Some( |
1684 | "trait Foo", | 1684 | "trait Foo", |
@@ -1718,7 +1718,7 @@ fn main() { let s<|>t = foo(); } | |||
1718 | 6..9, | 1718 | 6..9, |
1719 | ), | 1719 | ), |
1720 | name: "Foo", | 1720 | name: "Foo", |
1721 | kind: TRAIT_DEF, | 1721 | kind: TRAIT, |
1722 | container_name: None, | 1722 | container_name: None, |
1723 | description: Some( | 1723 | description: Some( |
1724 | "trait Foo", | 1724 | "trait Foo", |
@@ -1777,7 +1777,7 @@ fn main() { let s<|>t = foo(); } | |||
1777 | 6..9, | 1777 | 6..9, |
1778 | ), | 1778 | ), |
1779 | name: "Foo", | 1779 | name: "Foo", |
1780 | kind: TRAIT_DEF, | 1780 | kind: TRAIT, |
1781 | container_name: None, | 1781 | container_name: None, |
1782 | description: Some( | 1782 | description: Some( |
1783 | "trait Foo", | 1783 | "trait Foo", |
@@ -1796,7 +1796,7 @@ fn main() { let s<|>t = foo(); } | |||
1796 | 19..22, | 1796 | 19..22, |
1797 | ), | 1797 | ), |
1798 | name: "Bar", | 1798 | name: "Bar", |
1799 | kind: TRAIT_DEF, | 1799 | kind: TRAIT, |
1800 | container_name: None, | 1800 | container_name: None, |
1801 | description: Some( | 1801 | description: Some( |
1802 | "trait Bar", | 1802 | "trait Bar", |
@@ -1839,7 +1839,7 @@ fn main() { let s<|>t = foo(); } | |||
1839 | 6..9, | 1839 | 6..9, |
1840 | ), | 1840 | ), |
1841 | name: "Foo", | 1841 | name: "Foo", |
1842 | kind: TRAIT_DEF, | 1842 | kind: TRAIT, |
1843 | container_name: None, | 1843 | container_name: None, |
1844 | description: Some( | 1844 | description: Some( |
1845 | "trait Foo", | 1845 | "trait Foo", |
@@ -1858,7 +1858,7 @@ fn main() { let s<|>t = foo(); } | |||
1858 | 22..25, | 1858 | 22..25, |
1859 | ), | 1859 | ), |
1860 | name: "Bar", | 1860 | name: "Bar", |
1861 | kind: TRAIT_DEF, | 1861 | kind: TRAIT, |
1862 | container_name: None, | 1862 | container_name: None, |
1863 | description: Some( | 1863 | description: Some( |
1864 | "trait Bar", | 1864 | "trait Bar", |
@@ -1933,7 +1933,7 @@ fn foo(ar<|>g: &impl Foo) {} | |||
1933 | 6..9, | 1933 | 6..9, |
1934 | ), | 1934 | ), |
1935 | name: "Foo", | 1935 | name: "Foo", |
1936 | kind: TRAIT_DEF, | 1936 | kind: TRAIT, |
1937 | container_name: None, | 1937 | container_name: None, |
1938 | description: Some( | 1938 | description: Some( |
1939 | "trait Foo", | 1939 | "trait Foo", |
@@ -1973,7 +1973,7 @@ fn foo(ar<|>g: &impl Foo + Bar<S>) {} | |||
1973 | 6..9, | 1973 | 6..9, |
1974 | ), | 1974 | ), |
1975 | name: "Foo", | 1975 | name: "Foo", |
1976 | kind: TRAIT_DEF, | 1976 | kind: TRAIT, |
1977 | container_name: None, | 1977 | container_name: None, |
1978 | description: Some( | 1978 | description: Some( |
1979 | "trait Foo", | 1979 | "trait Foo", |
@@ -1992,7 +1992,7 @@ fn foo(ar<|>g: &impl Foo + Bar<S>) {} | |||
1992 | 19..22, | 1992 | 19..22, |
1993 | ), | 1993 | ), |
1994 | name: "Bar", | 1994 | name: "Bar", |
1995 | kind: TRAIT_DEF, | 1995 | kind: TRAIT, |
1996 | container_name: None, | 1996 | container_name: None, |
1997 | description: Some( | 1997 | description: Some( |
1998 | "trait Bar", | 1998 | "trait Bar", |
@@ -2049,7 +2049,7 @@ fn foo(ar<|>g: &impl Foo<S>) {} | |||
2049 | 6..9, | 2049 | 6..9, |
2050 | ), | 2050 | ), |
2051 | name: "Foo", | 2051 | name: "Foo", |
2052 | kind: TRAIT_DEF, | 2052 | kind: TRAIT, |
2053 | container_name: None, | 2053 | container_name: None, |
2054 | description: Some( | 2054 | description: Some( |
2055 | "trait Foo", | 2055 | "trait Foo", |
@@ -2130,7 +2130,7 @@ fn main() { let s<|>t = foo(); } | |||
2130 | 6..9, | 2130 | 6..9, |
2131 | ), | 2131 | ), |
2132 | name: "Foo", | 2132 | name: "Foo", |
2133 | kind: TRAIT_DEF, | 2133 | kind: TRAIT, |
2134 | container_name: None, | 2134 | container_name: None, |
2135 | description: Some( | 2135 | description: Some( |
2136 | "trait Foo", | 2136 | "trait Foo", |
@@ -2167,7 +2167,7 @@ fn foo(ar<|>g: &dyn Foo) {} | |||
2167 | 6..9, | 2167 | 6..9, |
2168 | ), | 2168 | ), |
2169 | name: "Foo", | 2169 | name: "Foo", |
2170 | kind: TRAIT_DEF, | 2170 | kind: TRAIT, |
2171 | container_name: None, | 2171 | container_name: None, |
2172 | description: Some( | 2172 | description: Some( |
2173 | "trait Foo", | 2173 | "trait Foo", |
@@ -2205,7 +2205,7 @@ fn foo(ar<|>g: &dyn Foo<S>) {} | |||
2205 | 6..9, | 2205 | 6..9, |
2206 | ), | 2206 | ), |
2207 | name: "Foo", | 2207 | name: "Foo", |
2208 | kind: TRAIT_DEF, | 2208 | kind: TRAIT, |
2209 | container_name: None, | 2209 | container_name: None, |
2210 | description: Some( | 2210 | description: Some( |
2211 | "trait Foo", | 2211 | "trait Foo", |
@@ -2265,7 +2265,7 @@ fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {} | |||
2265 | 6..15, | 2265 | 6..15, |
2266 | ), | 2266 | ), |
2267 | name: "ImplTrait", | 2267 | name: "ImplTrait", |
2268 | kind: TRAIT_DEF, | 2268 | kind: TRAIT, |
2269 | container_name: None, | 2269 | container_name: None, |
2270 | description: Some( | 2270 | description: Some( |
2271 | "trait ImplTrait", | 2271 | "trait ImplTrait", |
@@ -2303,7 +2303,7 @@ fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {} | |||
2303 | 28..36, | 2303 | 28..36, |
2304 | ), | 2304 | ), |
2305 | name: "DynTrait", | 2305 | name: "DynTrait", |
2306 | kind: TRAIT_DEF, | 2306 | kind: TRAIT, |
2307 | container_name: None, | 2307 | container_name: None, |
2308 | description: Some( | 2308 | description: Some( |
2309 | "trait DynTrait", | 2309 | "trait DynTrait", |
@@ -2370,7 +2370,7 @@ fn main() { let s<|>t = test().get(); } | |||
2370 | 6..9, | 2370 | 6..9, |
2371 | ), | 2371 | ), |
2372 | name: "Foo", | 2372 | name: "Foo", |
2373 | kind: TRAIT_DEF, | 2373 | kind: TRAIT, |
2374 | container_name: None, | 2374 | container_name: None, |
2375 | description: Some( | 2375 | description: Some( |
2376 | "trait Foo", | 2376 | "trait Foo", |
diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs index d8ffb8c84..d330109f1 100644 --- a/crates/ra_ide/src/references/rename.rs +++ b/crates/ra_ide/src/references/rename.rs | |||
@@ -192,15 +192,14 @@ fn text_edit_from_self_param( | |||
192 | self_param: &ast::SelfParam, | 192 | self_param: &ast::SelfParam, |
193 | new_name: &str, | 193 | new_name: &str, |
194 | ) -> Option<TextEdit> { | 194 | ) -> Option<TextEdit> { |
195 | fn target_type_name(impl_def: &ast::ImplDef) -> Option<String> { | 195 | fn target_type_name(impl_def: &ast::Impl) -> Option<String> { |
196 | if let Some(ast::TypeRef::PathType(p)) = impl_def.target_type() { | 196 | if let Some(ast::TypeRef::PathType(p)) = impl_def.target_type() { |
197 | return Some(p.path()?.segment()?.name_ref()?.text().to_string()); | 197 | return Some(p.path()?.segment()?.name_ref()?.text().to_string()); |
198 | } | 198 | } |
199 | None | 199 | None |
200 | } | 200 | } |
201 | 201 | ||
202 | let impl_def = | 202 | let impl_def = find_node_at_offset::<ast::Impl>(syn, self_param.syntax().text_range().start())?; |
203 | find_node_at_offset::<ast::ImplDef>(syn, self_param.syntax().text_range().start())?; | ||
204 | let type_name = target_type_name(&impl_def)?; | 203 | let type_name = target_type_name(&impl_def)?; |
205 | 204 | ||
206 | let mut replacement_text = String::from(new_name); | 205 | let mut replacement_text = String::from(new_name); |
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 19ec73d2a..e3a96f9d5 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs | |||
@@ -647,7 +647,7 @@ fn highlight_element( | |||
647 | 647 | ||
648 | fn is_child_of_impl(element: &SyntaxElement) -> bool { | 648 | fn is_child_of_impl(element: &SyntaxElement) -> bool { |
649 | match element.parent() { | 649 | match element.parent() { |
650 | Some(e) => e.kind() == IMPL_DEF, | 650 | Some(e) => e.kind() == IMPL, |
651 | _ => false, | 651 | _ => false, |
652 | } | 652 | } |
653 | } | 653 | } |
@@ -708,7 +708,7 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight { | |||
708 | STRUCT => HighlightTag::Struct, | 708 | STRUCT => HighlightTag::Struct, |
709 | ENUM => HighlightTag::Enum, | 709 | ENUM => HighlightTag::Enum, |
710 | UNION => HighlightTag::Union, | 710 | UNION => HighlightTag::Union, |
711 | TRAIT_DEF => HighlightTag::Trait, | 711 | TRAIT => HighlightTag::Trait, |
712 | TYPE_ALIAS => HighlightTag::TypeAlias, | 712 | TYPE_ALIAS => HighlightTag::TypeAlias, |
713 | TYPE_PARAM => HighlightTag::TypeParam, | 713 | TYPE_PARAM => HighlightTag::TypeParam, |
714 | RECORD_FIELD => HighlightTag::Field, | 714 | RECORD_FIELD => HighlightTag::Field, |