diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-06 12:23:26 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-06 12:23:26 +0000 |
commit | 736a55c97e69f95e6ff4a0c3dafb2018e8ea05f9 (patch) | |
tree | 4f82dda9b02ca33d154cefd46ced58596bc2065c /crates/ra_syntax/src | |
parent | 569e1e871e737ade80616288241d63e1531dbb8d (diff) | |
parent | d107926f8621dfc08010ffc5bf4a1ac6356c6c87 (diff) |
Merge #748
748: Fill deprecation for LSP r=kjeremy a=kjeremy
Co-authored-by: kjeremy <[email protected]>
Co-authored-by: Jeremy Kolb <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/ast.rs | 10 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 1 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar.ron | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index 3d22a88f3..d6237532b 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs | |||
@@ -177,6 +177,16 @@ impl Attr { | |||
177 | None | 177 | None |
178 | } | 178 | } |
179 | } | 179 | } |
180 | |||
181 | pub fn as_named(&self) -> Option<SmolStr> { | ||
182 | let tt = self.value()?; | ||
183 | let attr = tt.syntax().children().nth(1)?; | ||
184 | if attr.kind() == IDENT { | ||
185 | Some(attr.leaf_text().unwrap().clone()) | ||
186 | } else { | ||
187 | None | ||
188 | } | ||
189 | } | ||
180 | } | 190 | } |
181 | 191 | ||
182 | impl Comment { | 192 | impl Comment { |
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index a8d60e882..60314d245 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -755,6 +755,7 @@ impl ToOwned for EnumVariant { | |||
755 | 755 | ||
756 | impl ast::NameOwner for EnumVariant {} | 756 | impl ast::NameOwner for EnumVariant {} |
757 | impl ast::DocCommentsOwner for EnumVariant {} | 757 | impl ast::DocCommentsOwner for EnumVariant {} |
758 | impl ast::AttrsOwner for EnumVariant {} | ||
758 | impl EnumVariant { | 759 | impl EnumVariant { |
759 | pub fn expr(&self) -> Option<&Expr> { | 760 | pub fn expr(&self) -> Option<&Expr> { |
760 | super::child_opt(self) | 761 | super::child_opt(self) |
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 2ed1fd1b8..046db5885 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron | |||
@@ -281,7 +281,7 @@ Grammar( | |||
281 | "DocCommentsOwner" | 281 | "DocCommentsOwner" |
282 | ], options: [["variant_list", "EnumVariantList"]] ), | 282 | ], options: [["variant_list", "EnumVariantList"]] ), |
283 | "EnumVariantList": ( collections: [["variants", "EnumVariant"]] ), | 283 | "EnumVariantList": ( collections: [["variants", "EnumVariant"]] ), |
284 | "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner"], options: ["Expr"] ), | 284 | "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner", "AttrsOwner"], options: ["Expr"] ), |
285 | "TraitDef": ( traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner", "TypeParamsOwner"] ), | 285 | "TraitDef": ( traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner", "TypeParamsOwner"] ), |
286 | "Module": ( | 286 | "Module": ( |
287 | traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ], | 287 | traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ], |