diff options
author | kjeremy <[email protected]> | 2019-02-05 22:05:46 +0000 |
---|---|---|
committer | kjeremy <[email protected]> | 2019-02-05 22:05:46 +0000 |
commit | 852b08379473cc3ee06878c5aae809b63d76cbc3 (patch) | |
tree | 5634fb37d72d9c627eeea54d6612f6a029349751 /crates/ra_syntax/src | |
parent | 569e1e871e737ade80616288241d63e1531dbb8d (diff) |
Fill deprecation for LSP
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" ], |