diff options
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/snapshots/highlight_injection.html | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/snapshots/highlight_strings.html | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/snapshots/highlight_unsafe.html | 53 | ||||
-rw-r--r-- | crates/ra_ide/src/snapshots/highlighting.html | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/snapshots/rainbow_highlighting.html | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting.rs | 8 | ||||
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting/html.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting/tags.rs | 4 |
8 files changed, 72 insertions, 13 deletions
diff --git a/crates/ra_ide/src/snapshots/highlight_injection.html b/crates/ra_ide/src/snapshots/highlight_injection.html index 748f07625..1b0349bae 100644 --- a/crates/ra_ide/src/snapshots/highlight_injection.html +++ b/crates/ra_ide/src/snapshots/highlight_injection.html | |||
@@ -12,8 +12,8 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
12 | .string_literal { color: #CC9393; } | 12 | .string_literal { color: #CC9393; } |
13 | .field { color: #94BFF3; } | 13 | .field { color: #94BFF3; } |
14 | .function { color: #93E0E3; } | 14 | .function { color: #93E0E3; } |
15 | .function.unsafe { color: #E28C14; } | 15 | .function.unsafe { color: #BC8383; } |
16 | .operator.unsafe { color: #E28C14; } | 16 | .operator.unsafe { color: #BC8383; } |
17 | .parameter { color: #94BFF3; } | 17 | .parameter { color: #94BFF3; } |
18 | .text { color: #DCDCCC; } | 18 | .text { color: #DCDCCC; } |
19 | .type { color: #7CB8BB; } | 19 | .type { color: #7CB8BB; } |
diff --git a/crates/ra_ide/src/snapshots/highlight_strings.html b/crates/ra_ide/src/snapshots/highlight_strings.html index 12a68ce62..d184b5691 100644 --- a/crates/ra_ide/src/snapshots/highlight_strings.html +++ b/crates/ra_ide/src/snapshots/highlight_strings.html | |||
@@ -12,8 +12,8 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
12 | .string_literal { color: #CC9393; } | 12 | .string_literal { color: #CC9393; } |
13 | .field { color: #94BFF3; } | 13 | .field { color: #94BFF3; } |
14 | .function { color: #93E0E3; } | 14 | .function { color: #93E0E3; } |
15 | .function.unsafe { color: #E28C14; } | 15 | .function.unsafe { color: #BC8383; } |
16 | .operator.unsafe { color: #E28C14; } | 16 | .operator.unsafe { color: #BC8383; } |
17 | .parameter { color: #94BFF3; } | 17 | .parameter { color: #94BFF3; } |
18 | .text { color: #DCDCCC; } | 18 | .text { color: #DCDCCC; } |
19 | .type { color: #7CB8BB; } | 19 | .type { color: #7CB8BB; } |
diff --git a/crates/ra_ide/src/snapshots/highlight_unsafe.html b/crates/ra_ide/src/snapshots/highlight_unsafe.html new file mode 100644 index 000000000..6936e949f --- /dev/null +++ b/crates/ra_ide/src/snapshots/highlight_unsafe.html | |||
@@ -0,0 +1,53 @@ | |||
1 | |||
2 | <style> | ||
3 | body { margin: 0; } | ||
4 | pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } | ||
5 | |||
6 | .lifetime { color: #DFAF8F; font-style: italic; } | ||
7 | .comment { color: #7F9F7F; } | ||
8 | .documentation { color: #629755; } | ||
9 | .injected { opacity: 0.65 ; } | ||
10 | .struct, .enum { color: #7CB8BB; } | ||
11 | .enum_variant { color: #BDE0F3; } | ||
12 | .string_literal { color: #CC9393; } | ||
13 | .field { color: #94BFF3; } | ||
14 | .function { color: #93E0E3; } | ||
15 | .function.unsafe { color: #BC8383; } | ||
16 | .operator.unsafe { color: #BC8383; } | ||
17 | .parameter { color: #94BFF3; } | ||
18 | .text { color: #DCDCCC; } | ||
19 | .type { color: #7CB8BB; } | ||
20 | .builtin_type { color: #8CD0D3; } | ||
21 | .type_param { color: #DFAF8F; } | ||
22 | .attribute { color: #94BFF3; } | ||
23 | .numeric_literal { color: #BFEBBF; } | ||
24 | .bool_literal { color: #BFE6EB; } | ||
25 | .macro { color: #94BFF3; } | ||
26 | .module { color: #AFD8AF; } | ||
27 | .variable { color: #DCDCCC; } | ||
28 | .format_specifier { color: #CC696B; } | ||
29 | .mutable { text-decoration: underline; } | ||
30 | .unresolved_reference { color: #FC5555; } | ||
31 | .escape_sequence { color: #94BFF3; } | ||
32 | |||
33 | .keyword { color: #F0DFAF; font-weight: bold; } | ||
34 | .keyword.unsafe { color: #BC8383; font-weight: bold; } | ||
35 | .control { font-style: italic; } | ||
36 | </style> | ||
37 | <pre><code><span class="keyword unsafe">unsafe</span> <span class="keyword">fn</span> <span class="function declaration unsafe">unsafe_fn</span>() {} | ||
38 | |||
39 | <span class="keyword">struct</span> <span class="struct declaration">HasUnsafeFn</span>; | ||
40 | |||
41 | <span class="keyword">impl</span> <span class="struct">HasUnsafeFn</span> { | ||
42 | <span class="keyword unsafe">unsafe</span> <span class="keyword">fn</span> <span class="function declaration unsafe">unsafe_method</span>(&<span class="self_keyword">self</span>) {} | ||
43 | } | ||
44 | |||
45 | <span class="keyword">fn</span> <span class="function declaration">main</span>() { | ||
46 | <span class="keyword">let</span> <span class="variable declaration">x</span> = &<span class="numeric_literal">5</span> <span class="keyword">as</span> *<span class="keyword">const</span> <span class="builtin_type">usize</span>; | ||
47 | <span class="keyword unsafe">unsafe</span> { | ||
48 | <span class="function unsafe">unsafe_fn</span>(); | ||
49 | <span class="struct">HasUnsafeFn</span>.<span class="function unsafe">unsafe_method</span>(); | ||
50 | <span class="keyword">let</span> <span class="variable declaration">y</span> = <span class="operator unsafe">*</span>(<span class="variable">x</span>); | ||
51 | <span class="keyword">let</span> <span class="variable declaration">z</span> = -<span class="variable">x</span>; | ||
52 | } | ||
53 | }</code></pre> \ No newline at end of file | ||
diff --git a/crates/ra_ide/src/snapshots/highlighting.html b/crates/ra_ide/src/snapshots/highlighting.html index d093a6266..8d0b38f95 100644 --- a/crates/ra_ide/src/snapshots/highlighting.html +++ b/crates/ra_ide/src/snapshots/highlighting.html | |||
@@ -12,8 +12,8 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
12 | .string_literal { color: #CC9393; } | 12 | .string_literal { color: #CC9393; } |
13 | .field { color: #94BFF3; } | 13 | .field { color: #94BFF3; } |
14 | .function { color: #93E0E3; } | 14 | .function { color: #93E0E3; } |
15 | .function.unsafe { color: #E28C14; } | 15 | .function.unsafe { color: #BC8383; } |
16 | .operator.unsafe { color: #E28C14; } | 16 | .operator.unsafe { color: #BC8383; } |
17 | .parameter { color: #94BFF3; } | 17 | .parameter { color: #94BFF3; } |
18 | .text { color: #DCDCCC; } | 18 | .text { color: #DCDCCC; } |
19 | .type { color: #7CB8BB; } | 19 | .type { color: #7CB8BB; } |
diff --git a/crates/ra_ide/src/snapshots/rainbow_highlighting.html b/crates/ra_ide/src/snapshots/rainbow_highlighting.html index 192d564a6..9516c7441 100644 --- a/crates/ra_ide/src/snapshots/rainbow_highlighting.html +++ b/crates/ra_ide/src/snapshots/rainbow_highlighting.html | |||
@@ -12,8 +12,8 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
12 | .string_literal { color: #CC9393; } | 12 | .string_literal { color: #CC9393; } |
13 | .field { color: #94BFF3; } | 13 | .field { color: #94BFF3; } |
14 | .function { color: #93E0E3; } | 14 | .function { color: #93E0E3; } |
15 | .function.unsafe { color: #E28C14; } | 15 | .function.unsafe { color: #BC8383; } |
16 | .operator.unsafe { color: #E28C14; } | 16 | .operator.unsafe { color: #BC8383; } |
17 | .parameter { color: #94BFF3; } | 17 | .parameter { color: #94BFF3; } |
18 | .text { color: #DCDCCC; } | 18 | .text { color: #DCDCCC; } |
19 | .type { color: #7CB8BB; } | 19 | .type { color: #7CB8BB; } |
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index fb4f2ce38..028b55902 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs | |||
@@ -605,7 +605,13 @@ fn highlight_name(db: &RootDatabase, def: Definition) -> Highlight { | |||
605 | Definition::Field(_) => HighlightTag::Field, | 605 | Definition::Field(_) => HighlightTag::Field, |
606 | Definition::ModuleDef(def) => match def { | 606 | Definition::ModuleDef(def) => match def { |
607 | hir::ModuleDef::Module(_) => HighlightTag::Module, | 607 | hir::ModuleDef::Module(_) => HighlightTag::Module, |
608 | hir::ModuleDef::Function(_) => HighlightTag::Function, | 608 | hir::ModuleDef::Function(func) => { |
609 | let mut h = HighlightTag::Function.into(); | ||
610 | if func.is_unsafe(db) { | ||
611 | h |= HighlightModifier::Unsafe; | ||
612 | } | ||
613 | return h; | ||
614 | } | ||
609 | hir::ModuleDef::Adt(hir::Adt::Struct(_)) => HighlightTag::Struct, | 615 | hir::ModuleDef::Adt(hir::Adt::Struct(_)) => HighlightTag::Struct, |
610 | hir::ModuleDef::Adt(hir::Adt::Enum(_)) => HighlightTag::Enum, | 616 | hir::ModuleDef::Adt(hir::Adt::Enum(_)) => HighlightTag::Enum, |
611 | hir::ModuleDef::Adt(hir::Adt::Union(_)) => HighlightTag::Union, | 617 | hir::ModuleDef::Adt(hir::Adt::Union(_)) => HighlightTag::Union, |
diff --git a/crates/ra_ide/src/syntax_highlighting/html.rs b/crates/ra_ide/src/syntax_highlighting/html.rs index 3477610e5..0c74f7370 100644 --- a/crates/ra_ide/src/syntax_highlighting/html.rs +++ b/crates/ra_ide/src/syntax_highlighting/html.rs | |||
@@ -71,8 +71,8 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
71 | .string_literal { color: #CC9393; } | 71 | .string_literal { color: #CC9393; } |
72 | .field { color: #94BFF3; } | 72 | .field { color: #94BFF3; } |
73 | .function { color: #93E0E3; } | 73 | .function { color: #93E0E3; } |
74 | .function.unsafe { color: #E28C14; } | 74 | .function.unsafe { color: #BC8383; } |
75 | .operator.unsafe { color: #E28C14; } | 75 | .operator.unsafe { color: #BC8383; } |
76 | .parameter { color: #94BFF3; } | 76 | .parameter { color: #94BFF3; } |
77 | .text { color: #DCDCCC; } | 77 | .text { color: #DCDCCC; } |
78 | .type { color: #7CB8BB; } | 78 | .type { color: #7CB8BB; } |
diff --git a/crates/ra_ide/src/syntax_highlighting/tags.rs b/crates/ra_ide/src/syntax_highlighting/tags.rs index b9bea4729..13d9dd195 100644 --- a/crates/ra_ide/src/syntax_highlighting/tags.rs +++ b/crates/ra_ide/src/syntax_highlighting/tags.rs | |||
@@ -77,6 +77,7 @@ impl HighlightTag { | |||
77 | HighlightTag::EnumVariant => "enum_variant", | 77 | HighlightTag::EnumVariant => "enum_variant", |
78 | HighlightTag::EscapeSequence => "escape_sequence", | 78 | HighlightTag::EscapeSequence => "escape_sequence", |
79 | HighlightTag::Field => "field", | 79 | HighlightTag::Field => "field", |
80 | HighlightTag::FormatSpecifier => "format_specifier", | ||
80 | HighlightTag::Function => "function", | 81 | HighlightTag::Function => "function", |
81 | HighlightTag::Generic => "generic", | 82 | HighlightTag::Generic => "generic", |
82 | HighlightTag::Keyword => "keyword", | 83 | HighlightTag::Keyword => "keyword", |
@@ -84,6 +85,7 @@ impl HighlightTag { | |||
84 | HighlightTag::Macro => "macro", | 85 | HighlightTag::Macro => "macro", |
85 | HighlightTag::Module => "module", | 86 | HighlightTag::Module => "module", |
86 | HighlightTag::NumericLiteral => "numeric_literal", | 87 | HighlightTag::NumericLiteral => "numeric_literal", |
88 | HighlightTag::Operator => "operator", | ||
87 | HighlightTag::SelfKeyword => "self_keyword", | 89 | HighlightTag::SelfKeyword => "self_keyword", |
88 | HighlightTag::SelfType => "self_type", | 90 | HighlightTag::SelfType => "self_type", |
89 | HighlightTag::Static => "static", | 91 | HighlightTag::Static => "static", |
@@ -95,8 +97,6 @@ impl HighlightTag { | |||
95 | HighlightTag::Union => "union", | 97 | HighlightTag::Union => "union", |
96 | HighlightTag::Local => "variable", | 98 | HighlightTag::Local => "variable", |
97 | HighlightTag::UnresolvedReference => "unresolved_reference", | 99 | HighlightTag::UnresolvedReference => "unresolved_reference", |
98 | HighlightTag::FormatSpecifier => "format_specifier", | ||
99 | HighlightTag::Operator => "operator", | ||
100 | } | 100 | } |
101 | } | 101 | } |
102 | } | 102 | } |