diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-12-07 18:48:35 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-12-07 18:48:35 +0000 |
commit | 03b886de53834168dd52b5e504a649292f129ae6 (patch) | |
tree | 8aa5589eef906e67a55ae2737ca1a6f731793f39 /crates | |
parent | 8a950dfb406a927085602af016855cfe1988aee1 (diff) | |
parent | a1c8bdecfd408b7573357604f9c6543556f3f19a (diff) |
Merge #6719
6719: Use items can also have doc comments r=matklad a=Veykril
Prior to this change modules show more docs than they have cause they inherit the docs from documented use items inside of them.
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ide/src/folding_ranges.rs | 13 | ||||
-rw-r--r-- | crates/syntax/src/ast/node_ext.rs | 1 | ||||
-rw-r--r-- | crates/syntax/src/parsing/text_tree_sink.rs | 2 | ||||
-rw-r--r-- | crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rast | 18 | ||||
-rw-r--r-- | crates/syntax/test_data/parser/inline/ok/0110_use_path.rast | 12 |
5 files changed, 23 insertions, 23 deletions
diff --git a/crates/ide/src/folding_ranges.rs b/crates/ide/src/folding_ranges.rs index 7523aec55..45170dd29 100644 --- a/crates/ide/src/folding_ranges.rs +++ b/crates/ide/src/folding_ranges.rs | |||
@@ -83,7 +83,6 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> { | |||
83 | fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> { | 83 | fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> { |
84 | match kind { | 84 | match kind { |
85 | COMMENT => Some(FoldKind::Comment), | 85 | COMMENT => Some(FoldKind::Comment), |
86 | USE => Some(FoldKind::Imports), | ||
87 | ARG_LIST | PARAM_LIST => Some(FoldKind::ArgList), | 86 | ARG_LIST | PARAM_LIST => Some(FoldKind::ArgList), |
88 | ASSOC_ITEM_LIST | 87 | ASSOC_ITEM_LIST |
89 | | RECORD_FIELD_LIST | 88 | | RECORD_FIELD_LIST |
@@ -258,11 +257,11 @@ fn main() <fold block>{ | |||
258 | fn test_fold_imports() { | 257 | fn test_fold_imports() { |
259 | check( | 258 | check( |
260 | r#" | 259 | r#" |
261 | <fold imports>use std::<fold block>{ | 260 | use std::<fold block>{ |
262 | str, | 261 | str, |
263 | vec, | 262 | vec, |
264 | io as iop | 263 | io as iop |
265 | }</fold>;</fold> | 264 | }</fold>; |
266 | 265 | ||
267 | fn main() <fold block>{ | 266 | fn main() <fold block>{ |
268 | }</fold>"#, | 267 | }</fold>"#, |
@@ -306,9 +305,9 @@ use std::io as iop;</fold> | |||
306 | <fold imports>use std::mem; | 305 | <fold imports>use std::mem; |
307 | use std::f64;</fold> | 306 | use std::f64;</fold> |
308 | 307 | ||
309 | use std::collections::HashMap; | 308 | <fold imports>use std::collections::HashMap; |
310 | // Some random comment | 309 | // Some random comment |
311 | use std::collections::VecDeque; | 310 | use std::collections::VecDeque;</fold> |
312 | 311 | ||
313 | fn main() <fold block>{ | 312 | fn main() <fold block>{ |
314 | }</fold>"#, | 313 | }</fold>"#, |
@@ -326,10 +325,10 @@ use std::io as iop;</fold> | |||
326 | <fold imports>use std::mem; | 325 | <fold imports>use std::mem; |
327 | use std::f64;</fold> | 326 | use std::f64;</fold> |
328 | 327 | ||
329 | <fold imports>use std::collections::<fold block>{ | 328 | use std::collections::<fold block>{ |
330 | HashMap, | 329 | HashMap, |
331 | VecDeque, | 330 | VecDeque, |
332 | }</fold>;</fold> | 331 | }</fold>; |
333 | // Some random comment | 332 | // Some random comment |
334 | 333 | ||
335 | fn main() <fold block>{ | 334 | fn main() <fold block>{ |
diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs index b70b840b8..aa3a4b606 100644 --- a/crates/syntax/src/ast/node_ext.rs +++ b/crates/syntax/src/ast/node_ext.rs | |||
@@ -477,3 +477,4 @@ impl ast::DocCommentsOwner for ast::Const {} | |||
477 | impl ast::DocCommentsOwner for ast::TypeAlias {} | 477 | impl ast::DocCommentsOwner for ast::TypeAlias {} |
478 | impl ast::DocCommentsOwner for ast::Impl {} | 478 | impl ast::DocCommentsOwner for ast::Impl {} |
479 | impl ast::DocCommentsOwner for ast::MacroCall {} | 479 | impl ast::DocCommentsOwner for ast::MacroCall {} |
480 | impl ast::DocCommentsOwner for ast::Use {} | ||
diff --git a/crates/syntax/src/parsing/text_tree_sink.rs b/crates/syntax/src/parsing/text_tree_sink.rs index 997bc5d28..49842177a 100644 --- a/crates/syntax/src/parsing/text_tree_sink.rs +++ b/crates/syntax/src/parsing/text_tree_sink.rs | |||
@@ -148,7 +148,7 @@ fn n_attached_trivias<'a>( | |||
148 | ) -> usize { | 148 | ) -> usize { |
149 | match kind { | 149 | match kind { |
150 | MACRO_CALL | CONST | TYPE_ALIAS | STRUCT | ENUM | VARIANT | FN | TRAIT | MODULE | 150 | MACRO_CALL | CONST | TYPE_ALIAS | STRUCT | ENUM | VARIANT | FN | TRAIT | MODULE |
151 | | RECORD_FIELD | STATIC => { | 151 | | RECORD_FIELD | STATIC | USE => { |
152 | let mut res = 0; | 152 | let mut res = 0; |
153 | let mut trivias = trivias.enumerate().peekable(); | 153 | let mut trivias = trivias.enumerate().peekable(); |
154 | 154 | ||
diff --git a/crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rast b/crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rast index 1e80dd7e2..b1fb75ed1 100644 --- a/crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rast +++ b/crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rast | |||
@@ -49,9 +49,9 @@ [email protected] | |||
49 | [email protected] "}" | 49 | [email protected] "}" |
50 | [email protected] ";" | 50 | [email protected] ";" |
51 | [email protected] " " | 51 | [email protected] " " |
52 | COMMENT@59..97 "// Rust 2018 (with a ..." | 52 | USE@59..121 |
53 | WHITESPACE@97..98 "\n" | 53 | COMMENT@59..97 "// Rust 2018 (with a ..." |
54 | USE@98..121 | 54 | WHITESPACE@97..98 "\n" |
55 | [email protected] "use" | 55 | [email protected] "use" |
56 | [email protected] " " | 56 | [email protected] " " |
57 | [email protected] | 57 | [email protected] |
@@ -75,9 +75,9 @@ [email protected] | |||
75 | [email protected] "}" | 75 | [email protected] "}" |
76 | [email protected] ";" | 76 | [email protected] ";" |
77 | [email protected] " " | 77 | [email protected] " " |
78 | COMMENT@122..134 "// Rust 2015" | 78 | US[email protected]66 |
79 | WHITESPACE@134..135 "\n" | 79 | COMMENT@122..134 "// Rust 2015" |
80 | USE@135..166 | 80 | WHITESPACE@134..135 "\n" |
81 | [email protected] "use" | 81 | [email protected] "use" |
82 | [email protected] " " | 82 | [email protected] " " |
83 | [email protected] | 83 | [email protected] |
@@ -102,9 +102,9 @@ [email protected] | |||
102 | [email protected] "}" | 102 | [email protected] "}" |
103 | [email protected] ";" | 103 | [email protected] ";" |
104 | [email protected] " " | 104 | [email protected] " " |
105 | COMMENT@167..179 "// Rust 2015" | 105 | US[email protected] |
106 | WHITESPACE@179..180 "\n" | 106 | COMMENT@167..179 "// Rust 2015" |
107 | USE@180..205 | 107 | WHITESPACE@179..180 "\n" |
108 | [email protected] "use" | 108 | [email protected] "use" |
109 | [email protected] " " | 109 | [email protected] " " |
110 | [email protected] | 110 | [email protected] |
diff --git a/crates/syntax/test_data/parser/inline/ok/0110_use_path.rast b/crates/syntax/test_data/parser/inline/ok/0110_use_path.rast index 82028096f..c9fad5f8c 100644 --- a/crates/syntax/test_data/parser/inline/ok/0110_use_path.rast +++ b/crates/syntax/test_data/parser/inline/ok/0110_use_path.rast | |||
@@ -10,9 +10,9 @@ [email protected] | |||
10 | [email protected] "crate_name" | 10 | [email protected] "crate_name" |
11 | [email protected] ";" | 11 | [email protected] ";" |
12 | [email protected] " " | 12 | [email protected] " " |
13 | COMMENT@18..45 "// Rust 2018 - All fl ..." | 13 | USE@18..61 |
14 | WHITESPACE@45..46 "\n" | 14 | COMMENT@18..45 "// Rust 2018 - All fl ..." |
15 | USE@46..61 | 15 | WHITESPACE@45..46 "\n" |
16 | [email protected] "use" | 16 | [email protected] "use" |
17 | [email protected] " " | 17 | [email protected] " " |
18 | [email protected] | 18 | [email protected] |
@@ -22,9 +22,9 @@ [email protected] | |||
22 | [email protected] "crate_name" | 22 | [email protected] "crate_name" |
23 | [email protected] ";" | 23 | [email protected] ";" |
24 | [email protected] " " | 24 | [email protected] " " |
25 | COMMENT@62..91 "// Rust 2018 - Anchor ..." | 25 | US[email protected]4 |
26 | WHITESPACE@91..92 "\n" | 26 | COMMENT@62..91 "// Rust 2018 - Anchor ..." |
27 | USE@92..124 | 27 | WHITESPACE@91..92 "\n" |
28 | [email protected] "use" | 28 | [email protected] "use" |
29 | [email protected] " " | 29 | [email protected] " " |
30 | [email protected] | 30 | [email protected] |