diff options
author | Lukas Wirth <[email protected]> | 2020-12-23 16:15:01 +0000 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2020-12-24 14:40:18 +0000 |
commit | 42e3f97c300c24b6ff9ff96ad0c24d386d3a253b (patch) | |
tree | 4142c4c99b034035bbc4e2b35ecd0f7e185b6855 /crates/ide | |
parent | e1acb0ca5ca2162be068fd6a07f7cc4ae171ed81 (diff) |
Support labels in reference search
Diffstat (limited to 'crates/ide')
18 files changed, 125 insertions, 8 deletions
diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs index cd8ec54fa..6431e7d6d 100644 --- a/crates/ide/src/display/navigation_target.rs +++ b/crates/ide/src/display/navigation_target.rs | |||
@@ -5,7 +5,7 @@ use std::fmt; | |||
5 | use either::Either; | 5 | use either::Either; |
6 | use hir::{AssocItem, Documentation, FieldSource, HasAttrs, HasSource, InFile, ModuleSource}; | 6 | use hir::{AssocItem, Documentation, FieldSource, HasAttrs, HasSource, InFile, ModuleSource}; |
7 | use ide_db::{ | 7 | use ide_db::{ |
8 | base_db::{FileId, SourceDatabase}, | 8 | base_db::{FileId, FileRange, SourceDatabase}, |
9 | symbol_index::FileSymbolKind, | 9 | symbol_index::FileSymbolKind, |
10 | }; | 10 | }; |
11 | use ide_db::{defs::Definition, RootDatabase}; | 11 | use ide_db::{defs::Definition, RootDatabase}; |
@@ -28,6 +28,7 @@ pub enum SymbolKind { | |||
28 | ValueParam, | 28 | ValueParam, |
29 | SelfParam, | 29 | SelfParam, |
30 | Local, | 30 | Local, |
31 | Label, | ||
31 | Function, | 32 | Function, |
32 | Const, | 33 | Const, |
33 | Static, | 34 | Static, |
@@ -223,6 +224,7 @@ impl TryToNav for Definition { | |||
223 | Definition::Local(it) => Some(it.to_nav(db)), | 224 | Definition::Local(it) => Some(it.to_nav(db)), |
224 | Definition::TypeParam(it) => Some(it.to_nav(db)), | 225 | Definition::TypeParam(it) => Some(it.to_nav(db)), |
225 | Definition::LifetimeParam(it) => Some(it.to_nav(db)), | 226 | Definition::LifetimeParam(it) => Some(it.to_nav(db)), |
227 | Definition::Label(it) => Some(it.to_nav(db)), | ||
226 | } | 228 | } |
227 | } | 229 | } |
228 | } | 230 | } |
@@ -421,6 +423,27 @@ impl ToNav for hir::Local { | |||
421 | } | 423 | } |
422 | } | 424 | } |
423 | 425 | ||
426 | impl ToNav for hir::Label { | ||
427 | fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { | ||
428 | let src = self.source(db); | ||
429 | let node = src.value.syntax(); | ||
430 | let FileRange { file_id, range } = src.with_value(node).original_file_range(db); | ||
431 | let focus_range = | ||
432 | src.value.lifetime().and_then(|lt| lt.lifetime_ident_token()).map(|lt| lt.text_range()); | ||
433 | let name = self.name(db).to_string().into(); | ||
434 | NavigationTarget { | ||
435 | file_id, | ||
436 | name, | ||
437 | kind: Some(SymbolKind::Label), | ||
438 | full_range: range, | ||
439 | focus_range, | ||
440 | container_name: None, | ||
441 | description: None, | ||
442 | docs: None, | ||
443 | } | ||
444 | } | ||
445 | } | ||
446 | |||
424 | impl ToNav for hir::TypeParam { | 447 | impl ToNav for hir::TypeParam { |
425 | fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { | 448 | fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { |
426 | let src = self.source(db); | 449 | let src = self.source(db); |
diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index b61ea0b3e..e10516f43 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs | |||
@@ -193,7 +193,8 @@ fn rewrite_intra_doc_link( | |||
193 | Definition::SelfType(_) | 193 | Definition::SelfType(_) |
194 | | Definition::Local(_) | 194 | | Definition::Local(_) |
195 | | Definition::TypeParam(_) | 195 | | Definition::TypeParam(_) |
196 | | Definition::LifetimeParam(_) => return None, | 196 | | Definition::LifetimeParam(_) |
197 | | Definition::Label(_) => return None, | ||
197 | }?; | 198 | }?; |
198 | let krate = resolved.module(db)?.krate(); | 199 | let krate = resolved.module(db)?.krate(); |
199 | let canonical_path = resolved.canonical_path(db)?; | 200 | let canonical_path = resolved.canonical_path(db)?; |
diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index 431da5d9c..65e45c920 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs | |||
@@ -1105,4 +1105,19 @@ fn foo<T>() where T: for<'a> Foo<&'a<|> (u8, u16)>, {} | |||
1105 | "#, | 1105 | "#, |
1106 | ); | 1106 | ); |
1107 | } | 1107 | } |
1108 | |||
1109 | #[test] | ||
1110 | fn goto_label() { | ||
1111 | check( | ||
1112 | r#" | ||
1113 | fn foo<'foo>(_: &'foo ()) { | ||
1114 | 'foo: { | ||
1115 | //^^^^ | ||
1116 | 'bar: loop { | ||
1117 | break 'foo<|>; | ||
1118 | } | ||
1119 | } | ||
1120 | }"#, | ||
1121 | ) | ||
1122 | } | ||
1108 | } | 1123 | } |
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 52f993cc9..73245fbe7 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs | |||
@@ -370,7 +370,7 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> { | |||
370 | Adt::Enum(it) => from_def_source(db, it, mod_path), | 370 | Adt::Enum(it) => from_def_source(db, it, mod_path), |
371 | }) | 371 | }) |
372 | } | 372 | } |
373 | Definition::TypeParam(_) | Definition::LifetimeParam(_) => { | 373 | Definition::TypeParam(_) | Definition::LifetimeParam(_) | Definition::Label(_) => { |
374 | // FIXME: Hover for generic param | 374 | // FIXME: Hover for generic param |
375 | None | 375 | None |
376 | } | 376 | } |
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs index 33b7358f7..21b2d7ca1 100644 --- a/crates/ide/src/references.rs +++ b/crates/ide/src/references.rs | |||
@@ -130,7 +130,7 @@ pub(crate) fn find_all_refs( | |||
130 | kind = ReferenceKind::FieldShorthandForLocal; | 130 | kind = ReferenceKind::FieldShorthandForLocal; |
131 | } | 131 | } |
132 | } | 132 | } |
133 | } else if let Definition::LifetimeParam(_) = def { | 133 | } else if matches!(def, Definition::LifetimeParam(_) | Definition::Label(_)) { |
134 | kind = ReferenceKind::Lifetime; | 134 | kind = ReferenceKind::Lifetime; |
135 | }; | 135 | }; |
136 | 136 | ||
@@ -1122,4 +1122,26 @@ fn main() { | |||
1122 | "#]], | 1122 | "#]], |
1123 | ); | 1123 | ); |
1124 | } | 1124 | } |
1125 | |||
1126 | #[test] | ||
1127 | fn test_find_labels() { | ||
1128 | check( | ||
1129 | r#" | ||
1130 | fn foo<'a>() -> &'a () { | ||
1131 | 'a: loop { | ||
1132 | 'b: loop { | ||
1133 | continue 'a<|>; | ||
1134 | } | ||
1135 | break 'a; | ||
1136 | } | ||
1137 | } | ||
1138 | "#, | ||
1139 | expect![[r#" | ||
1140 | 'a Label FileId(0) 29..32 29..31 Lifetime | ||
1141 | |||
1142 | FileId(0) 80..82 Lifetime | ||
1143 | FileId(0) 108..110 Lifetime | ||
1144 | "#]], | ||
1145 | ); | ||
1146 | } | ||
1125 | } | 1147 | } |
diff --git a/crates/ide/src/references/rename.rs b/crates/ide/src/references/rename.rs index cd721b7eb..4f353852f 100644 --- a/crates/ide/src/references/rename.rs +++ b/crates/ide/src/references/rename.rs | |||
@@ -1523,4 +1523,29 @@ fn main() { | |||
1523 | }"#, | 1523 | }"#, |
1524 | ); | 1524 | ); |
1525 | } | 1525 | } |
1526 | |||
1527 | #[test] | ||
1528 | fn test_rename_label() { | ||
1529 | check( | ||
1530 | "'foo", | ||
1531 | r#" | ||
1532 | fn foo<'a>() -> &'a () { | ||
1533 | 'a: { | ||
1534 | 'b: loop { | ||
1535 | break 'a<|>; | ||
1536 | } | ||
1537 | } | ||
1538 | } | ||
1539 | "#, | ||
1540 | r#" | ||
1541 | fn foo<'a>() -> &'a () { | ||
1542 | 'foo: { | ||
1543 | 'b: loop { | ||
1544 | break 'foo; | ||
1545 | } | ||
1546 | } | ||
1547 | } | ||
1548 | "#, | ||
1549 | ) | ||
1550 | } | ||
1526 | } | 1551 | } |
diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index 00c717c7c..5ad96581b 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs | |||
@@ -560,10 +560,20 @@ fn highlight_element( | |||
560 | CHAR => HighlightTag::CharLiteral.into(), | 560 | CHAR => HighlightTag::CharLiteral.into(), |
561 | QUESTION => Highlight::new(HighlightTag::Operator) | HighlightModifier::ControlFlow, | 561 | QUESTION => Highlight::new(HighlightTag::Operator) | HighlightModifier::ControlFlow, |
562 | LIFETIME => { | 562 | LIFETIME => { |
563 | let h = Highlight::new(HighlightTag::Symbol(SymbolKind::LifetimeParam)); | 563 | let lifetime = element.into_node().and_then(ast::Lifetime::cast).unwrap(); |
564 | match element.parent().map(|it| it.kind()) { | 564 | |
565 | Some(LIFETIME_PARAM) | Some(LABEL) => h | HighlightModifier::Definition, | 565 | match NameClass::classify_lifetime(sema, &lifetime) { |
566 | _ => h, | 566 | Some(NameClass::Definition(def)) => { |
567 | highlight_def(db, def) | HighlightModifier::Definition | ||
568 | } | ||
569 | None => match NameRefClass::classify_lifetime(sema, &lifetime) { | ||
570 | Some(NameRefClass::Definition(def)) => highlight_def(db, def), | ||
571 | _ => Highlight::new(HighlightTag::Symbol(SymbolKind::LifetimeParam)), | ||
572 | }, | ||
573 | _ => { | ||
574 | Highlight::new(HighlightTag::Symbol(SymbolKind::LifetimeParam)) | ||
575 | | HighlightModifier::Definition | ||
576 | } | ||
567 | } | 577 | } |
568 | } | 578 | } |
569 | p if p.is_punct() => match p { | 579 | p if p.is_punct() => match p { |
@@ -825,6 +835,7 @@ fn highlight_def(db: &RootDatabase, def: Definition) -> Highlight { | |||
825 | return h; | 835 | return h; |
826 | } | 836 | } |
827 | Definition::LifetimeParam(_) => HighlightTag::Symbol(SymbolKind::LifetimeParam), | 837 | Definition::LifetimeParam(_) => HighlightTag::Symbol(SymbolKind::LifetimeParam), |
838 | Definition::Label(_) => HighlightTag::Symbol(SymbolKind::Label), | ||
828 | } | 839 | } |
829 | .into() | 840 | .into() |
830 | } | 841 | } |
diff --git a/crates/ide/src/syntax_highlighting/html.rs b/crates/ide/src/syntax_highlighting/html.rs index abcc5cccc..99ba3a59d 100644 --- a/crates/ide/src/syntax_highlighting/html.rs +++ b/crates/ide/src/syntax_highlighting/html.rs | |||
@@ -64,6 +64,7 @@ body { margin: 0; } | |||
64 | pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } | 64 | pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } |
65 | 65 | ||
66 | .lifetime { color: #DFAF8F; font-style: italic; } | 66 | .lifetime { color: #DFAF8F; font-style: italic; } |
67 | .label { color: #DFAF8F; font-style: italic; } | ||
67 | .comment { color: #7F9F7F; } | 68 | .comment { color: #7F9F7F; } |
68 | .documentation { color: #629755; } | 69 | .documentation { color: #629755; } |
69 | .injected { opacity: 0.65 ; } | 70 | .injected { opacity: 0.65 ; } |
diff --git a/crates/ide/src/syntax_highlighting/tags.rs b/crates/ide/src/syntax_highlighting/tags.rs index 974f54fa0..2a6cc0cab 100644 --- a/crates/ide/src/syntax_highlighting/tags.rs +++ b/crates/ide/src/syntax_highlighting/tags.rs | |||
@@ -80,6 +80,7 @@ impl HighlightTag { | |||
80 | SymbolKind::LifetimeParam => "lifetime", | 80 | SymbolKind::LifetimeParam => "lifetime", |
81 | SymbolKind::Macro => "macro", | 81 | SymbolKind::Macro => "macro", |
82 | SymbolKind::Local => "variable", | 82 | SymbolKind::Local => "variable", |
83 | SymbolKind::Label => "label", | ||
83 | SymbolKind::ValueParam => "value_param", | 84 | SymbolKind::ValueParam => "value_param", |
84 | SymbolKind::SelfParam => "self_keyword", | 85 | SymbolKind::SelfParam => "self_keyword", |
85 | SymbolKind::Impl => "self_type", | 86 | SymbolKind::Impl => "self_type", |
diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_assoc_functions.html b/crates/ide/src/syntax_highlighting/test_data/highlight_assoc_functions.html index db6f32d33..506ebe60e 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_assoc_functions.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_assoc_functions.html | |||
@@ -4,6 +4,7 @@ body { margin: 0; } | |||
4 | pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } | 4 | pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } |
5 | 5 | ||
6 | .lifetime { color: #DFAF8F; font-style: italic; } | 6 | .lifetime { color: #DFAF8F; font-style: italic; } |
7 | .label { color: #DFAF8F; font-style: italic; } | ||
7 | .comment { color: #7F9F7F; } | 8 | .comment { color: #7F9F7F; } |
8 | .documentation { color: #629755; } | 9 | .documentation { color: #629755; } |
9 | .injected { opacity: 0.65 ; } | 10 | .injected { opacity: 0.65 ; } |
diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html b/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html index 4e511baa9..4dd7413ba 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html | |||
@@ -4,6 +4,7 @@ body { margin: 0; } | |||
4 | pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } | 4 | pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } |
5 | 5 | ||
6 | .lifetime { color: #DFAF8F; font-style: italic; } | 6 | .lifetime { color: #DFAF8F; font-style: italic; } |
7 | .label { color: #DFAF8F; font-style: italic; } | ||
7 | .comment { color: #7F9F7F; } | 8 | .comment { color: #7F9F7F; } |
8 | .documentation { color: #629755; } | 9 | .documentation { color: #629755; } |
9 | .injected { opacity: 0.65 ; } | 10 | .injected { opacity: 0.65 ; } |
diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_extern_crate.html b/crates/ide/src/syntax_highlighting/test_data/highlight_extern_crate.html index 800d894c7..ed452586a 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_extern_crate.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_extern_crate.html | |||
@@ -4,6 +4,7 @@ body { margin: 0; } | |||
4 | pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } | 4 | pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } |
5 | 5 | ||
6 | .lifetime { color: #DFAF8F; font-style: italic; } | 6 | .lifetime { color: #DFAF8F; font-style: italic; } |
7 | .label { color: #DFAF8F; font-style: italic; } | ||
7 | .comment { color: #7F9F7F; } | 8 | .comment { color: #7F9F7F; } |
8 | .documentation { color: #629755; } | 9 | .documentation { color: #629755; } |
9 | .injected { opacity: 0.65 ; } | 10 | .injected { opacity: 0.65 ; } |
diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_injection.html b/crates/ide/src/syntax_highlighting/test_data/highlight_injection.html index 7f18ad297..92e7dc3e4 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_injection.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_injection.html | |||
@@ -4,6 +4,7 @@ body { margin: 0; } | |||
4 | pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } | 4 | pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } |
5 | 5 | ||
6 | .lifetime { color: #DFAF8F; font-style: italic; } | 6 | .lifetime { color: #DFAF8F; font-style: italic; } |
7 | .label { color: #DFAF8F; font-style: italic; } | ||
7 | .comment { color: #7F9F7F; } | 8 | .comment { color: #7F9F7F; } |
8 | .documentation { color: #629755; } | 9 | .documentation { color: #629755; } |
9 | .injected { opacity: 0.65 ; } | 10 | .injected { opacity: 0.65 ; } |
diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_strings.html b/crates/ide/src/syntax_highlighting/test_data/highlight_strings.html index c843b5085..31dad5d42 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_strings.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_strings.html | |||
@@ -4,6 +4,7 @@ body { margin: 0; } | |||
4 | pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } | 4 | pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } |
5 | 5 | ||
6 | .lifetime { color: #DFAF8F; font-style: italic; } | 6 | .lifetime { color: #DFAF8F; font-style: italic; } |
7 | .label { color: #DFAF8F; font-style: italic; } | ||
7 | .comment { color: #7F9F7F; } | 8 | .comment { color: #7F9F7F; } |
8 | .documentation { color: #629755; } | 9 | .documentation { color: #629755; } |
9 | .injected { opacity: 0.65 ; } | 10 | .injected { opacity: 0.65 ; } |
diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_unsafe.html b/crates/ide/src/syntax_highlighting/test_data/highlight_unsafe.html index d26f48516..e3a0aa317 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_unsafe.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_unsafe.html | |||
@@ -4,6 +4,7 @@ body { margin: 0; } | |||
4 | pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } | 4 | pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } |
5 | 5 | ||
6 | .lifetime { color: #DFAF8F; font-style: italic; } | 6 | .lifetime { color: #DFAF8F; font-style: italic; } |
7 | .label { color: #DFAF8F; font-style: italic; } | ||
7 | .comment { color: #7F9F7F; } | 8 | .comment { color: #7F9F7F; } |
8 | .documentation { color: #629755; } | 9 | .documentation { color: #629755; } |
9 | .injected { opacity: 0.65 ; } | 10 | .injected { opacity: 0.65 ; } |
diff --git a/crates/ide/src/syntax_highlighting/test_data/highlighting.html b/crates/ide/src/syntax_highlighting/test_data/highlighting.html index 588e86a34..72ff9dd40 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlighting.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlighting.html | |||
@@ -4,6 +4,7 @@ body { margin: 0; } | |||
4 | pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } | 4 | pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } |
5 | 5 | ||
6 | .lifetime { color: #DFAF8F; font-style: italic; } | 6 | .lifetime { color: #DFAF8F; font-style: italic; } |
7 | .label { color: #DFAF8F; font-style: italic; } | ||
7 | .comment { color: #7F9F7F; } | 8 | .comment { color: #7F9F7F; } |
8 | .documentation { color: #629755; } | 9 | .documentation { color: #629755; } |
9 | .injected { opacity: 0.65 ; } | 10 | .injected { opacity: 0.65 ; } |
@@ -194,6 +195,11 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
194 | <span class="keyword">let</span> <span class="variable declaration">baz</span> <span class="operator">=</span> <span class="operator">-</span><span class="variable">baz</span><span class="punctuation">;</span> | 195 | <span class="keyword">let</span> <span class="variable declaration">baz</span> <span class="operator">=</span> <span class="operator">-</span><span class="variable">baz</span><span class="punctuation">;</span> |
195 | 196 | ||
196 | <span class="keyword">let</span> <span class="punctuation">_</span> <span class="operator">=</span> <span class="operator">!</span><span class="bool_literal">true</span><span class="punctuation">;</span> | 197 | <span class="keyword">let</span> <span class="punctuation">_</span> <span class="operator">=</span> <span class="operator">!</span><span class="bool_literal">true</span><span class="punctuation">;</span> |
198 | |||
199 | <span class="label declaration">'foo</span><span class="punctuation">:</span> <span class="keyword control">loop</span> <span class="punctuation">{</span> | ||
200 | <span class="keyword control">break</span> <span class="label">'foo</span><span class="punctuation">;</span> | ||
201 | <span class="keyword control">continue</span> <span class="label">'foo</span><span class="punctuation">;</span> | ||
202 | <span class="punctuation">}</span> | ||
197 | <span class="punctuation">}</span> | 203 | <span class="punctuation">}</span> |
198 | 204 | ||
199 | <span class="keyword">enum</span> <span class="enum declaration">Option</span><span class="punctuation"><</span><span class="type_param declaration">T</span><span class="punctuation">></span> <span class="punctuation">{</span> | 205 | <span class="keyword">enum</span> <span class="enum declaration">Option</span><span class="punctuation"><</span><span class="type_param declaration">T</span><span class="punctuation">></span> <span class="punctuation">{</span> |
diff --git a/crates/ide/src/syntax_highlighting/test_data/rainbow_highlighting.html b/crates/ide/src/syntax_highlighting/test_data/rainbow_highlighting.html index c7589605f..8b3dfa69f 100644 --- a/crates/ide/src/syntax_highlighting/test_data/rainbow_highlighting.html +++ b/crates/ide/src/syntax_highlighting/test_data/rainbow_highlighting.html | |||
@@ -4,6 +4,7 @@ body { margin: 0; } | |||
4 | pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } | 4 | pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } |
5 | 5 | ||
6 | .lifetime { color: #DFAF8F; font-style: italic; } | 6 | .lifetime { color: #DFAF8F; font-style: italic; } |
7 | .label { color: #DFAF8F; font-style: italic; } | ||
7 | .comment { color: #7F9F7F; } | 8 | .comment { color: #7F9F7F; } |
8 | .documentation { color: #629755; } | 9 | .documentation { color: #629755; } |
9 | .injected { opacity: 0.65 ; } | 10 | .injected { opacity: 0.65 ; } |
diff --git a/crates/ide/src/syntax_highlighting/tests.rs b/crates/ide/src/syntax_highlighting/tests.rs index f53d2c3ba..e0df0d2b5 100644 --- a/crates/ide/src/syntax_highlighting/tests.rs +++ b/crates/ide/src/syntax_highlighting/tests.rs | |||
@@ -168,6 +168,11 @@ fn main() { | |||
168 | let baz = -baz; | 168 | let baz = -baz; |
169 | 169 | ||
170 | let _ = !true; | 170 | let _ = !true; |
171 | |||
172 | 'foo: loop { | ||
173 | break 'foo; | ||
174 | continue 'foo; | ||
175 | } | ||
171 | } | 176 | } |
172 | 177 | ||
173 | enum Option<T> { | 178 | enum Option<T> { |