aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/syntax_highlighting
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-02-28 15:49:46 +0000
committerAleksey Kladov <[email protected]>2020-02-28 15:53:12 +0000
commit56ce34c6a7ec0b4426d4cb25e10512c7efaf6f06 (patch)
treeeec2d0d619cba2989313e66a87207b1641264a74 /crates/ra_ide/src/syntax_highlighting
parent5ebfcb9cb757ece936f631cf69136e1d38cb6afc (diff)
Correctly flag 'lifetime definitions as definitions
Diffstat (limited to 'crates/ra_ide/src/syntax_highlighting')
-rw-r--r--crates/ra_ide/src/syntax_highlighting/html.rs2
-rw-r--r--crates/ra_ide/src/syntax_highlighting/tags.rs8
-rw-r--r--crates/ra_ide/src/syntax_highlighting/tests.rs9
3 files changed, 11 insertions, 8 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting/html.rs b/crates/ra_ide/src/syntax_highlighting/html.rs
index 54678c278..e13766c9d 100644
--- a/crates/ra_ide/src/syntax_highlighting/html.rs
+++ b/crates/ra_ide/src/syntax_highlighting/html.rs
@@ -80,7 +80,7 @@ const STYLE: &str = "
80body { margin: 0; } 80body { margin: 0; }
81pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } 81pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; }
82 82
83 83.lifetime { color: #DFAF8F; font-style: italic; }
84.comment { color: #7F9F7F; } 84.comment { color: #7F9F7F; }
85.struct, .enum { color: #7CB8BB; } 85.struct, .enum { color: #7CB8BB; }
86.enum_variant { color: #BDE0F3; } 86.enum_variant { color: #BDE0F3; }
diff --git a/crates/ra_ide/src/syntax_highlighting/tags.rs b/crates/ra_ide/src/syntax_highlighting/tags.rs
index 9da80823c..8835a5de2 100644
--- a/crates/ra_ide/src/syntax_highlighting/tags.rs
+++ b/crates/ra_ide/src/syntax_highlighting/tags.rs
@@ -90,8 +90,12 @@ impl fmt::Display for HighlightTag {
90} 90}
91 91
92impl HighlightModifier { 92impl HighlightModifier {
93 const ALL: &'static [HighlightModifier] = 93 const ALL: &'static [HighlightModifier] = &[
94 &[HighlightModifier::Mutable, HighlightModifier::Unsafe, HighlightModifier::Control]; 94 HighlightModifier::Control,
95 HighlightModifier::Definition,
96 HighlightModifier::Mutable,
97 HighlightModifier::Unsafe,
98 ];
95 99
96 fn as_str(self) -> &'static str { 100 fn as_str(self) -> &'static str {
97 match self { 101 match self {
diff --git a/crates/ra_ide/src/syntax_highlighting/tests.rs b/crates/ra_ide/src/syntax_highlighting/tests.rs
index 21c4dd818..98c030791 100644
--- a/crates/ra_ide/src/syntax_highlighting/tests.rs
+++ b/crates/ra_ide/src/syntax_highlighting/tests.rs
@@ -17,9 +17,8 @@ struct Foo {
17 pub y: i32, 17 pub y: i32,
18} 18}
19 19
20fn foo<T>() -> T { 20fn foo<'a, T>() -> T {
21 unimplemented!(); 21 foo::<'a, i32>()
22 foo::<i32>();
23} 22}
24 23
25macro_rules! def_fn { 24macro_rules! def_fn {
@@ -59,7 +58,7 @@ use Option::*;
59impl<T> Option<T> { 58impl<T> Option<T> {
60 fn and<U>(self, other: Option<U>) -> Option<(T, U)> { 59 fn and<U>(self, other: Option<U>) -> Option<(T, U)> {
61 match other { 60 match other {
62 None => todo!(), 61 None => unimplemented!(),
63 Nope => Nope, 62 Nope => Nope,
64 } 63 }
65 } 64 }
@@ -130,5 +129,5 @@ fn test_ranges() {
130 .highlight_range(FileRange { file_id, range: TextRange::offset_len(82.into(), 1.into()) }) 129 .highlight_range(FileRange { file_id, range: TextRange::offset_len(82.into(), 1.into()) })
131 .unwrap(); 130 .unwrap();
132 131
133 assert_eq!(&highlights[0].highlight.to_string(), "field"); 132 assert_eq!(&highlights[0].highlight.to_string(), "field.declaration");
134} 133}