diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-24 01:22:29 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-24 01:22:29 +0000 |
commit | 6a0a4a564accb12b48e703245655e3e3a0637445 (patch) | |
tree | 248097d8ceaded63601e3d663ef795e3bae55bfe /crates/ra_syntax/src | |
parent | bf9cd6ee30b3044b61e99e24e82fad56d3965417 (diff) | |
parent | f87ce73579759fdb623f1d8d82880c0d6306746e (diff) |
Merge #621
621: Completion docs for code model r=kjeremy a=kjeremy
Adds a way to access documentation through the code model and exposes it to completions. Also allows us to document enum variants.
Co-authored-by: Jeremy A. Kolb <[email protected]>
Co-authored-by: Jeremy Kolb <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 1 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar.ron | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/parser_impl/event.rs | 3 |
3 files changed, 4 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 9fe946172..ac6c8a835 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -632,6 +632,7 @@ impl AstNode for EnumVariant { | |||
632 | 632 | ||
633 | 633 | ||
634 | impl ast::NameOwner for EnumVariant {} | 634 | impl ast::NameOwner for EnumVariant {} |
635 | impl ast::DocCommentsOwner for EnumVariant {} | ||
635 | impl EnumVariant { | 636 | impl EnumVariant { |
636 | pub fn expr(&self) -> Option<&Expr> { | 637 | pub fn expr(&self) -> Option<&Expr> { |
637 | super::child_opt(self) | 638 | super::child_opt(self) |
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 0385183fd..c5297e46d 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron | |||
@@ -279,7 +279,7 @@ Grammar( | |||
279 | "DocCommentsOwner" | 279 | "DocCommentsOwner" |
280 | ], options: [["variant_list", "EnumVariantList"]] ), | 280 | ], options: [["variant_list", "EnumVariantList"]] ), |
281 | "EnumVariantList": ( collections: [["variants", "EnumVariant"]] ), | 281 | "EnumVariantList": ( collections: [["variants", "EnumVariant"]] ), |
282 | "EnumVariant": ( traits: ["NameOwner"], options: ["Expr"] ), | 282 | "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner"], options: ["Expr"] ), |
283 | "TraitDef": ( traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner"] ), | 283 | "TraitDef": ( traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner"] ), |
284 | "Module": ( | 284 | "Module": ( |
285 | traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ], | 285 | traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ], |
diff --git a/crates/ra_syntax/src/parser_impl/event.rs b/crates/ra_syntax/src/parser_impl/event.rs index 73dd6e02b..bd77fee89 100644 --- a/crates/ra_syntax/src/parser_impl/event.rs +++ b/crates/ra_syntax/src/parser_impl/event.rs | |||
@@ -249,7 +249,8 @@ fn n_attached_trivias<'a>( | |||
249 | trivias: impl Iterator<Item = (SyntaxKind, &'a str)>, | 249 | trivias: impl Iterator<Item = (SyntaxKind, &'a str)>, |
250 | ) -> usize { | 250 | ) -> usize { |
251 | match kind { | 251 | match kind { |
252 | CONST_DEF | TYPE_DEF | STRUCT_DEF | ENUM_DEF | FN_DEF | TRAIT_DEF | MODULE => { | 252 | CONST_DEF | TYPE_DEF | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN_DEF | TRAIT_DEF |
253 | | MODULE => { | ||
253 | let mut res = 0; | 254 | let mut res = 0; |
254 | for (i, (kind, text)) in trivias.enumerate() { | 255 | for (i, (kind, text)) in trivias.enumerate() { |
255 | match kind { | 256 | match kind { |