aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/syntax_highlighting
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-02-28 15:56:07 +0000
committerGitHub <[email protected]>2020-02-28 15:56:07 +0000
commitc692e07b4ff648fea742c53c0dbad57d6f652068 (patch)
treed186df8fb298272eaa4ce14d2fccc854413bc566 /crates/ra_ide/src/syntax_highlighting
parent93f632ca4e7bb7fd54830e456d629a4948a92337 (diff)
parent56ce34c6a7ec0b4426d4cb25e10512c7efaf6f06 (diff)
Merge #3367
3367: Fix highlighting of const patterns r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
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.rs24
3 files changed, 22 insertions, 12 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 2d90a072f..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 {
@@ -50,12 +49,19 @@ fn main() {
50 y; 49 y;
51} 50}
52 51
53enum E<X> { 52enum Option<T> {
54 V(X) 53 Some(T),
54 None,
55} 55}
56 56use Option::*;
57impl<X> E<X> { 57
58 fn new<T>() -> E<T> {} 58impl<T> Option<T> {
59 fn and<U>(self, other: Option<U>) -> Option<(T, U)> {
60 match other {
61 None => unimplemented!(),
62 Nope => Nope,
63 }
64 }
59} 65}
60"# 66"#
61 .trim(), 67 .trim(),
@@ -123,5 +129,5 @@ fn test_ranges() {
123 .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()) })
124 .unwrap(); 130 .unwrap();
125 131
126 assert_eq!(&highlights[0].highlight.to_string(), "field"); 132 assert_eq!(&highlights[0].highlight.to_string(), "field.declaration");
127} 133}