diff options
Diffstat (limited to 'crates')
9 files changed, 67 insertions, 35 deletions
diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index d44a1b45f..5259d86d2 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs | |||
@@ -137,6 +137,7 @@ pub struct HlRange { | |||
137 | // injected:: Emitted for doc-string injected highlighting like rust source blocks in documentation. | 137 | // injected:: Emitted for doc-string injected highlighting like rust source blocks in documentation. |
138 | // intraDocLink:: Emitted for intra doc links in doc-strings. | 138 | // intraDocLink:: Emitted for intra doc links in doc-strings. |
139 | // library:: Emitted for items that are defined outside of the current crate. | 139 | // library:: Emitted for items that are defined outside of the current crate. |
140 | // public:: Emitted for items that are from the current crate and are `pub`. | ||
140 | // mutable:: Emitted for mutable locals and statics. | 141 | // mutable:: Emitted for mutable locals and statics. |
141 | // static:: Emitted for "static" functions, also known as functions that do not take a `self` param, as well as statics and consts. | 142 | // static:: Emitted for "static" functions, also known as functions that do not take a `self` param, as well as statics and consts. |
142 | // trait:: Emitted for associated trait items. | 143 | // trait:: Emitted for associated trait items. |
diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs index 6834fe11a..82e16a51b 100644 --- a/crates/ide/src/syntax_highlighting/highlight.rs +++ b/crates/ide/src/syntax_highlighting/highlight.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! Computes color for a single element. | 1 | //! Computes color for a single element. |
2 | 2 | ||
3 | use hir::{AsAssocItem, Semantics}; | 3 | use hir::{AsAssocItem, HasVisibility, Semantics}; |
4 | use ide_db::{ | 4 | use ide_db::{ |
5 | defs::{Definition, NameClass, NameRefClass}, | 5 | defs::{Definition, NameClass, NameRefClass}, |
6 | RootDatabase, SymbolKind, | 6 | RootDatabase, SymbolKind, |
@@ -439,9 +439,12 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition) | |||
439 | 439 | ||
440 | let is_from_other_crate = def.module(db).map(hir::Module::krate) != krate; | 440 | let is_from_other_crate = def.module(db).map(hir::Module::krate) != krate; |
441 | let is_builtin_type = matches!(def, Definition::ModuleDef(hir::ModuleDef::BuiltinType(_))); | 441 | let is_builtin_type = matches!(def, Definition::ModuleDef(hir::ModuleDef::BuiltinType(_))); |
442 | let is_public = def.visibility(db) == Some(hir::Visibility::Public); | ||
442 | 443 | ||
443 | if is_from_other_crate && !is_builtin_type { | 444 | match (is_from_other_crate, is_builtin_type, is_public) { |
444 | h |= HlMod::Library; | 445 | (true, false, _) => h |= HlMod::Library, |
446 | (false, _, true) => h |= HlMod::Public, | ||
447 | _ => {} | ||
445 | } | 448 | } |
446 | 449 | ||
447 | h | 450 | h |
@@ -475,8 +478,14 @@ fn highlight_method_call( | |||
475 | if func.as_assoc_item(sema.db).and_then(|it| it.containing_trait(sema.db)).is_some() { | 478 | if func.as_assoc_item(sema.db).and_then(|it| it.containing_trait(sema.db)).is_some() { |
476 | h |= HlMod::Trait; | 479 | h |= HlMod::Trait; |
477 | } | 480 | } |
478 | if Some(func.module(sema.db).krate()) != krate { | 481 | |
482 | let is_from_other_crate = Some(func.module(sema.db).krate()) != krate; | ||
483 | let is_public = func.visibility(sema.db) == hir::Visibility::Public; | ||
484 | |||
485 | if is_from_other_crate { | ||
479 | h |= HlMod::Library; | 486 | h |= HlMod::Library; |
487 | } else if is_public { | ||
488 | h |= HlMod::Public; | ||
480 | } | 489 | } |
481 | 490 | ||
482 | if let Some(self_param) = func.self_param(sema.db) { | 491 | if let Some(self_param) = func.self_param(sema.db) { |
diff --git a/crates/ide/src/syntax_highlighting/tags.rs b/crates/ide/src/syntax_highlighting/tags.rs index 9d481deae..b4d59d00b 100644 --- a/crates/ide/src/syntax_highlighting/tags.rs +++ b/crates/ide/src/syntax_highlighting/tags.rs | |||
@@ -71,6 +71,8 @@ pub enum HlMod { | |||
71 | Async, | 71 | Async, |
72 | /// Used for items from other crates. | 72 | /// Used for items from other crates. |
73 | Library, | 73 | Library, |
74 | /// Used for public items. | ||
75 | Public, | ||
74 | // Keep this last! | 76 | // Keep this last! |
75 | /// Used for unsafe functions, unsafe traits, mutable statics, union accesses and unsafe operations. | 77 | /// Used for unsafe functions, unsafe traits, mutable statics, union accesses and unsafe operations. |
76 | Unsafe, | 78 | Unsafe, |
@@ -194,6 +196,7 @@ impl HlMod { | |||
194 | HlMod::Trait, | 196 | HlMod::Trait, |
195 | HlMod::Async, | 197 | HlMod::Async, |
196 | HlMod::Library, | 198 | HlMod::Library, |
199 | HlMod::Public, | ||
197 | HlMod::Unsafe, | 200 | HlMod::Unsafe, |
198 | ]; | 201 | ]; |
199 | 202 | ||
@@ -213,6 +216,7 @@ impl HlMod { | |||
213 | HlMod::Trait => "trait", | 216 | HlMod::Trait => "trait", |
214 | HlMod::Async => "async", | 217 | HlMod::Async => "async", |
215 | HlMod::Library => "library", | 218 | HlMod::Library => "library", |
219 | HlMod::Public => "public", | ||
216 | HlMod::Unsafe => "unsafe", | 220 | HlMod::Unsafe => "unsafe", |
217 | } | 221 | } |
218 | } | 222 | } |
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 4e85f7c0b..9326d9d45 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 | |||
@@ -43,8 +43,8 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
43 | <span class="keyword">struct</span> <span class="struct declaration">foo</span> <span class="brace">{</span><span class="brace">}</span> | 43 | <span class="keyword">struct</span> <span class="struct declaration">foo</span> <span class="brace">{</span><span class="brace">}</span> |
44 | 44 | ||
45 | <span class="keyword">impl</span> <span class="struct">foo</span> <span class="brace">{</span> | 45 | <span class="keyword">impl</span> <span class="struct">foo</span> <span class="brace">{</span> |
46 | <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function associated declaration static">is_static</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> | 46 | <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function associated declaration static public">is_static</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> |
47 | <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function associated declaration">is_not_static</span><span class="parenthesis">(</span><span class="operator">&</span><span class="self_keyword declaration">self</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> | 47 | <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function associated declaration public">is_not_static</span><span class="parenthesis">(</span><span class="operator">&</span><span class="self_keyword declaration">self</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> |
48 | <span class="brace">}</span> | 48 | <span class="brace">}</span> |
49 | 49 | ||
50 | <span class="keyword">trait</span> <span class="trait declaration">t</span> <span class="brace">{</span> | 50 | <span class="keyword">trait</span> <span class="trait declaration">t</span> <span class="brace">{</span> |
@@ -53,7 +53,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
53 | <span class="brace">}</span> | 53 | <span class="brace">}</span> |
54 | 54 | ||
55 | <span class="keyword">impl</span> <span class="trait">t</span> <span class="keyword">for</span> <span class="struct">foo</span> <span class="brace">{</span> | 55 | <span class="keyword">impl</span> <span class="trait">t</span> <span class="keyword">for</span> <span class="struct">foo</span> <span class="brace">{</span> |
56 | <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function associated declaration static trait">is_static</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> | 56 | <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function associated declaration static trait public">is_static</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> |
57 | <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function associated declaration trait">is_not_static</span><span class="parenthesis">(</span><span class="operator">&</span><span class="self_keyword declaration">self</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> | 57 | <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function associated declaration trait public">is_not_static</span><span class="parenthesis">(</span><span class="operator">&</span><span class="self_keyword declaration">self</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> |
58 | <span class="brace">}</span> | 58 | <span class="brace">}</span> |
59 | </code></pre> \ No newline at end of file | 59 | </code></pre> \ No newline at end of file |
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 79a285107..1f2f83a08 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html | |||
@@ -63,7 +63,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
63 | <span class="comment">// KILLER WHALE</span> | 63 | <span class="comment">// KILLER WHALE</span> |
64 | <span class="comment documentation">/// </span><span class="string_literal injected"> Ishmael."</span><span class="semicolon injected">;</span> | 64 | <span class="comment documentation">/// </span><span class="string_literal injected"> Ishmael."</span><span class="semicolon injected">;</span> |
65 | <span class="comment documentation">/// ```</span> | 65 | <span class="comment documentation">/// ```</span> |
66 | <span class="keyword">pub</span> <span class="keyword">const</span> <span class="constant associated declaration">bar</span><span class="colon">:</span> <span class="builtin_type">bool</span> <span class="operator">=</span> <span class="bool_literal">true</span><span class="semicolon">;</span> | 66 | <span class="keyword">pub</span> <span class="keyword">const</span> <span class="constant associated declaration public">bar</span><span class="colon">:</span> <span class="builtin_type">bool</span> <span class="operator">=</span> <span class="bool_literal">true</span><span class="semicolon">;</span> |
67 | 67 | ||
68 | <span class="comment documentation">/// Constructs a new `Foo`.</span> | 68 | <span class="comment documentation">/// Constructs a new `Foo`.</span> |
69 | <span class="comment documentation">///</span> | 69 | <span class="comment documentation">///</span> |
@@ -73,7 +73,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
73 | <span class="comment documentation">/// #</span><span class="none injected"> </span><span class="attribute attribute injected">#</span><span class="attribute attribute injected">!</span><span class="attribute attribute injected">[</span><span class="function attribute injected">allow</span><span class="parenthesis attribute injected">(</span><span class="attribute attribute injected">unused_mut</span><span class="parenthesis attribute injected">)</span><span class="attribute attribute injected">]</span> | 73 | <span class="comment documentation">/// #</span><span class="none injected"> </span><span class="attribute attribute injected">#</span><span class="attribute attribute injected">!</span><span class="attribute attribute injected">[</span><span class="function attribute injected">allow</span><span class="parenthesis attribute injected">(</span><span class="attribute attribute injected">unused_mut</span><span class="parenthesis attribute injected">)</span><span class="attribute attribute injected">]</span> |
74 | <span class="comment documentation">/// </span><span class="keyword injected">let</span><span class="none injected"> </span><span class="keyword injected">mut</span><span class="none injected"> </span><span class="variable declaration injected mutable">foo</span><span class="colon injected">:</span><span class="none injected"> </span><span class="struct injected">Foo</span><span class="none injected"> </span><span class="operator injected">=</span><span class="none injected"> </span><span class="struct injected">Foo</span><span class="operator injected">::</span><span class="function injected">new</span><span class="parenthesis injected">(</span><span class="parenthesis injected">)</span><span class="semicolon injected">;</span> | 74 | <span class="comment documentation">/// </span><span class="keyword injected">let</span><span class="none injected"> </span><span class="keyword injected">mut</span><span class="none injected"> </span><span class="variable declaration injected mutable">foo</span><span class="colon injected">:</span><span class="none injected"> </span><span class="struct injected">Foo</span><span class="none injected"> </span><span class="operator injected">=</span><span class="none injected"> </span><span class="struct injected">Foo</span><span class="operator injected">::</span><span class="function injected">new</span><span class="parenthesis injected">(</span><span class="parenthesis injected">)</span><span class="semicolon injected">;</span> |
75 | <span class="comment documentation">/// ```</span> | 75 | <span class="comment documentation">/// ```</span> |
76 | <span class="keyword">pub</span> <span class="keyword">const</span> <span class="keyword">fn</span> <span class="function associated declaration static">new</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="struct">Foo</span> <span class="brace">{</span> | 76 | <span class="keyword">pub</span> <span class="keyword">const</span> <span class="keyword">fn</span> <span class="function associated declaration static public">new</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="struct">Foo</span> <span class="brace">{</span> |
77 | <span class="struct">Foo</span> <span class="brace">{</span> <span class="field">bar</span><span class="colon">:</span> <span class="bool_literal">true</span> <span class="brace">}</span> | 77 | <span class="struct">Foo</span> <span class="brace">{</span> <span class="field">bar</span><span class="colon">:</span> <span class="bool_literal">true</span> <span class="brace">}</span> |
78 | <span class="brace">}</span> | 78 | <span class="brace">}</span> |
79 | 79 | ||
@@ -107,7 +107,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
107 | <span class="comment documentation">/// ```sh</span> | 107 | <span class="comment documentation">/// ```sh</span> |
108 | <span class="comment documentation">/// echo 1</span> | 108 | <span class="comment documentation">/// echo 1</span> |
109 | <span class="comment documentation">/// ```</span> | 109 | <span class="comment documentation">/// ```</span> |
110 | <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function associated declaration">foo</span><span class="parenthesis">(</span><span class="operator">&</span><span class="self_keyword declaration">self</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">bool</span> <span class="brace">{</span> | 110 | <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function associated declaration public">foo</span><span class="parenthesis">(</span><span class="operator">&</span><span class="self_keyword declaration">self</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">bool</span> <span class="brace">{</span> |
111 | <span class="bool_literal">true</span> | 111 | <span class="bool_literal">true</span> |
112 | <span class="brace">}</span> | 112 | <span class="brace">}</span> |
113 | <span class="brace">}</span> | 113 | <span class="brace">}</span> |
@@ -119,10 +119,10 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
119 | <span class="comment documentation">///</span> | 119 | <span class="comment documentation">///</span> |
120 | <span class="comment documentation">/// [`Item`]: module::Item</span> | 120 | <span class="comment documentation">/// [`Item`]: module::Item</span> |
121 | <span class="comment documentation">/// [mix_and_match]: ThisShouldntResolve</span> | 121 | <span class="comment documentation">/// [mix_and_match]: ThisShouldntResolve</span> |
122 | <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function declaration">all_the_links</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> | 122 | <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function declaration public">all_the_links</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> |
123 | 123 | ||
124 | <span class="keyword">pub</span> <span class="keyword">mod</span> <span class="module declaration">module</span> <span class="brace">{</span> | 124 | <span class="keyword">pub</span> <span class="keyword">mod</span> <span class="module declaration public">module</span> <span class="brace">{</span> |
125 | <span class="keyword">pub</span> <span class="keyword">struct</span> <span class="struct declaration">Item</span><span class="semicolon">;</span> | 125 | <span class="keyword">pub</span> <span class="keyword">struct</span> <span class="struct declaration public">Item</span><span class="semicolon">;</span> |
126 | <span class="brace">}</span> | 126 | <span class="brace">}</span> |
127 | 127 | ||
128 | <span class="comment documentation">/// ```</span> | 128 | <span class="comment documentation">/// ```</span> |
@@ -148,7 +148,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
148 | <span class="attribute attribute">#</span><span class="attribute attribute">[</span><span class="function attribute">cfg_attr</span><span class="parenthesis attribute">(</span><span class="attribute attribute">not</span><span class="parenthesis attribute">(</span><span class="attribute attribute">feature </span><span class="operator attribute">=</span><span class="attribute attribute"> </span><span class="string_literal attribute">"alloc"</span><span class="parenthesis attribute">)</span><span class="comma attribute">,</span><span class="attribute attribute"> doc </span><span class="operator attribute">=</span><span class="attribute attribute"> </span><span class="string_literal attribute">"```ignore"</span><span class="parenthesis attribute">)</span><span class="attribute attribute">]</span> | 148 | <span class="attribute attribute">#</span><span class="attribute attribute">[</span><span class="function attribute">cfg_attr</span><span class="parenthesis attribute">(</span><span class="attribute attribute">not</span><span class="parenthesis attribute">(</span><span class="attribute attribute">feature </span><span class="operator attribute">=</span><span class="attribute attribute"> </span><span class="string_literal attribute">"alloc"</span><span class="parenthesis attribute">)</span><span class="comma attribute">,</span><span class="attribute attribute"> doc </span><span class="operator attribute">=</span><span class="attribute attribute"> </span><span class="string_literal attribute">"```ignore"</span><span class="parenthesis attribute">)</span><span class="attribute attribute">]</span> |
149 | <span class="comment documentation">/// </span><span class="keyword injected">let</span><span class="none injected"> </span><span class="punctuation injected">_</span><span class="none injected"> </span><span class="operator injected">=</span><span class="none injected"> </span><span class="function injected">example</span><span class="parenthesis injected">(</span><span class="operator injected">&</span><span class="none injected">alloc::</span><span class="macro injected">vec!</span><span class="bracket injected">[</span><span class="numeric_literal injected">1</span><span class="comma injected">,</span><span class="none injected"> </span><span class="numeric_literal injected">2</span><span class="comma injected">,</span><span class="none injected"> </span><span class="numeric_literal injected">3</span><span class="bracket injected">]</span><span class="parenthesis injected">)</span><span class="semicolon injected">;</span> | 149 | <span class="comment documentation">/// </span><span class="keyword injected">let</span><span class="none injected"> </span><span class="punctuation injected">_</span><span class="none injected"> </span><span class="operator injected">=</span><span class="none injected"> </span><span class="function injected">example</span><span class="parenthesis injected">(</span><span class="operator injected">&</span><span class="none injected">alloc::</span><span class="macro injected">vec!</span><span class="bracket injected">[</span><span class="numeric_literal injected">1</span><span class="comma injected">,</span><span class="none injected"> </span><span class="numeric_literal injected">2</span><span class="comma injected">,</span><span class="none injected"> </span><span class="numeric_literal injected">3</span><span class="bracket injected">]</span><span class="parenthesis injected">)</span><span class="semicolon injected">;</span> |
150 | <span class="comment documentation">/// ```</span> | 150 | <span class="comment documentation">/// ```</span> |
151 | <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function declaration">mix_and_match</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> | 151 | <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function declaration public">mix_and_match</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> |
152 | 152 | ||
153 | <span class="comment documentation">/** | 153 | <span class="comment documentation">/** |
154 | It is beyond me why you'd use these when you got /// | 154 | It is beyond me why you'd use these when you got /// |
@@ -157,7 +157,7 @@ It is beyond me why you'd use these when you got /// | |||
157 | ``` | 157 | ``` |
158 | </span><span class="function documentation injected intra_doc_link">[`block_comments2`]</span><span class="comment documentation"> tests these with indentation | 158 | </span><span class="function documentation injected intra_doc_link">[`block_comments2`]</span><span class="comment documentation"> tests these with indentation |
159 | */</span> | 159 | */</span> |
160 | <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function declaration">block_comments</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> | 160 | <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function declaration public">block_comments</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> |
161 | 161 | ||
162 | <span class="comment documentation">/** | 162 | <span class="comment documentation">/** |
163 | Really, I don't get it | 163 | Really, I don't get it |
@@ -166,4 +166,4 @@ It is beyond me why you'd use these when you got /// | |||
166 | ``` | 166 | ``` |
167 | </span><span class="function documentation injected intra_doc_link">[`block_comments`]</span><span class="comment documentation"> tests these without indentation | 167 | </span><span class="function documentation injected intra_doc_link">[`block_comments`]</span><span class="comment documentation"> tests these without indentation |
168 | */</span> | 168 | */</span> |
169 | <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function declaration">block_comments2</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span></code></pre> \ No newline at end of file | 169 | <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function declaration public">block_comments2</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span></code></pre> \ No newline at end of file |
diff --git a/crates/ide/src/syntax_highlighting/test_data/highlighting.html b/crates/ide/src/syntax_highlighting/test_data/highlighting.html index 9232cf905..63daf25c6 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlighting.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlighting.html | |||
@@ -45,26 +45,26 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
45 | <span class="keyword">macro</span> <span class="macro declaration">Copy</span> <span class="brace">{</span><span class="brace">}</span> | 45 | <span class="keyword">macro</span> <span class="macro declaration">Copy</span> <span class="brace">{</span><span class="brace">}</span> |
46 | 46 | ||
47 | <span class="comment">// Needed for function consuming vs normal</span> | 47 | <span class="comment">// Needed for function consuming vs normal</span> |
48 | <span class="keyword">pub</span> <span class="keyword">mod</span> <span class="module declaration">marker</span> <span class="brace">{</span> | 48 | <span class="keyword">pub</span> <span class="keyword">mod</span> <span class="module declaration public">marker</span> <span class="brace">{</span> |
49 | <span class="attribute attribute">#</span><span class="attribute attribute">[</span><span class="function attribute">lang</span><span class="attribute attribute"> </span><span class="operator attribute">=</span><span class="attribute attribute"> </span><span class="string_literal attribute">"copy"</span><span class="attribute attribute">]</span> | 49 | <span class="attribute attribute">#</span><span class="attribute attribute">[</span><span class="function attribute">lang</span><span class="attribute attribute"> </span><span class="operator attribute">=</span><span class="attribute attribute"> </span><span class="string_literal attribute">"copy"</span><span class="attribute attribute">]</span> |
50 | <span class="keyword">pub</span> <span class="keyword">trait</span> <span class="trait declaration">Copy</span> <span class="brace">{</span><span class="brace">}</span> | 50 | <span class="keyword">pub</span> <span class="keyword">trait</span> <span class="trait declaration public">Copy</span> <span class="brace">{</span><span class="brace">}</span> |
51 | <span class="brace">}</span> | 51 | <span class="brace">}</span> |
52 | 52 | ||
53 | <span class="keyword">pub</span> <span class="keyword">mod</span> <span class="module declaration">ops</span> <span class="brace">{</span> | 53 | <span class="keyword">pub</span> <span class="keyword">mod</span> <span class="module declaration public">ops</span> <span class="brace">{</span> |
54 | <span class="attribute attribute">#</span><span class="attribute attribute">[</span><span class="function attribute">lang</span><span class="attribute attribute"> </span><span class="operator attribute">=</span><span class="attribute attribute"> </span><span class="string_literal attribute">"fn_once"</span><span class="attribute attribute">]</span> | 54 | <span class="attribute attribute">#</span><span class="attribute attribute">[</span><span class="function attribute">lang</span><span class="attribute attribute"> </span><span class="operator attribute">=</span><span class="attribute attribute"> </span><span class="string_literal attribute">"fn_once"</span><span class="attribute attribute">]</span> |
55 | <span class="keyword">pub</span> <span class="keyword">trait</span> <span class="trait declaration">FnOnce</span><span class="angle"><</span><span class="type_param declaration">Args</span><span class="angle">></span> <span class="brace">{</span><span class="brace">}</span> | 55 | <span class="keyword">pub</span> <span class="keyword">trait</span> <span class="trait declaration public">FnOnce</span><span class="angle"><</span><span class="type_param declaration">Args</span><span class="angle">></span> <span class="brace">{</span><span class="brace">}</span> |
56 | 56 | ||
57 | <span class="attribute attribute">#</span><span class="attribute attribute">[</span><span class="function attribute">lang</span><span class="attribute attribute"> </span><span class="operator attribute">=</span><span class="attribute attribute"> </span><span class="string_literal attribute">"fn_mut"</span><span class="attribute attribute">]</span> | 57 | <span class="attribute attribute">#</span><span class="attribute attribute">[</span><span class="function attribute">lang</span><span class="attribute attribute"> </span><span class="operator attribute">=</span><span class="attribute attribute"> </span><span class="string_literal attribute">"fn_mut"</span><span class="attribute attribute">]</span> |
58 | <span class="keyword">pub</span> <span class="keyword">trait</span> <span class="trait declaration">FnMut</span><span class="angle"><</span><span class="type_param declaration">Args</span><span class="angle">></span><span class="colon">:</span> <span class="trait">FnOnce</span><span class="angle"><</span><span class="type_param">Args</span><span class="angle">></span> <span class="brace">{</span><span class="brace">}</span> | 58 | <span class="keyword">pub</span> <span class="keyword">trait</span> <span class="trait declaration public">FnMut</span><span class="angle"><</span><span class="type_param declaration">Args</span><span class="angle">></span><span class="colon">:</span> <span class="trait public">FnOnce</span><span class="angle"><</span><span class="type_param">Args</span><span class="angle">></span> <span class="brace">{</span><span class="brace">}</span> |
59 | 59 | ||
60 | <span class="attribute attribute">#</span><span class="attribute attribute">[</span><span class="function attribute">lang</span><span class="attribute attribute"> </span><span class="operator attribute">=</span><span class="attribute attribute"> </span><span class="string_literal attribute">"fn"</span><span class="attribute attribute">]</span> | 60 | <span class="attribute attribute">#</span><span class="attribute attribute">[</span><span class="function attribute">lang</span><span class="attribute attribute"> </span><span class="operator attribute">=</span><span class="attribute attribute"> </span><span class="string_literal attribute">"fn"</span><span class="attribute attribute">]</span> |
61 | <span class="keyword">pub</span> <span class="keyword">trait</span> <span class="trait declaration">Fn</span><span class="angle"><</span><span class="type_param declaration">Args</span><span class="angle">></span><span class="colon">:</span> <span class="trait">FnMut</span><span class="angle"><</span><span class="type_param">Args</span><span class="angle">></span> <span class="brace">{</span><span class="brace">}</span> | 61 | <span class="keyword">pub</span> <span class="keyword">trait</span> <span class="trait declaration public">Fn</span><span class="angle"><</span><span class="type_param declaration">Args</span><span class="angle">></span><span class="colon">:</span> <span class="trait public">FnMut</span><span class="angle"><</span><span class="type_param">Args</span><span class="angle">></span> <span class="brace">{</span><span class="brace">}</span> |
62 | <span class="brace">}</span> | 62 | <span class="brace">}</span> |
63 | 63 | ||
64 | 64 | ||
65 | <span class="keyword">struct</span> <span class="struct declaration">Foo</span> <span class="brace">{</span> | 65 | <span class="keyword">struct</span> <span class="struct declaration">Foo</span> <span class="brace">{</span> |
66 | <span class="keyword">pub</span> <span class="field declaration">x</span><span class="colon">:</span> <span class="builtin_type">i32</span><span class="comma">,</span> | 66 | <span class="keyword">pub</span> <span class="field declaration public">x</span><span class="colon">:</span> <span class="builtin_type">i32</span><span class="comma">,</span> |
67 | <span class="keyword">pub</span> <span class="field declaration">y</span><span class="colon">:</span> <span class="builtin_type">i32</span><span class="comma">,</span> | 67 | <span class="keyword">pub</span> <span class="field declaration public">y</span><span class="colon">:</span> <span class="builtin_type">i32</span><span class="comma">,</span> |
68 | <span class="brace">}</span> | 68 | <span class="brace">}</span> |
69 | 69 | ||
70 | <span class="keyword">trait</span> <span class="trait declaration">Bar</span> <span class="keyword">where</span> <span class="type_param">Self</span><span class="colon">:</span> <span class="brace">{</span> | 70 | <span class="keyword">trait</span> <span class="trait declaration">Bar</span> <span class="keyword">where</span> <span class="type_param">Self</span><span class="colon">:</span> <span class="brace">{</span> |
@@ -73,7 +73,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
73 | 73 | ||
74 | <span class="keyword">impl</span> <span class="trait">Bar</span> <span class="keyword">for</span> <span class="struct">Foo</span> <span class="keyword">where</span> <span class="self_type">Self</span><span class="colon">:</span> <span class="brace">{</span> | 74 | <span class="keyword">impl</span> <span class="trait">Bar</span> <span class="keyword">for</span> <span class="struct">Foo</span> <span class="keyword">where</span> <span class="self_type">Self</span><span class="colon">:</span> <span class="brace">{</span> |
75 | <span class="keyword">fn</span> <span class="function associated declaration trait">bar</span><span class="parenthesis">(</span><span class="operator">&</span><span class="self_keyword declaration">self</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">i32</span> <span class="brace">{</span> | 75 | <span class="keyword">fn</span> <span class="function associated declaration trait">bar</span><span class="parenthesis">(</span><span class="operator">&</span><span class="self_keyword declaration">self</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">i32</span> <span class="brace">{</span> |
76 | <span class="self_keyword">self</span><span class="operator">.</span><span class="field">x</span> | 76 | <span class="self_keyword">self</span><span class="operator">.</span><span class="field public">x</span> |
77 | <span class="brace">}</span> | 77 | <span class="brace">}</span> |
78 | <span class="brace">}</span> | 78 | <span class="brace">}</span> |
79 | 79 | ||
@@ -83,11 +83,11 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
83 | <span class="brace">}</span> | 83 | <span class="brace">}</span> |
84 | 84 | ||
85 | <span class="keyword">fn</span> <span class="function associated declaration mutable">qux</span><span class="parenthesis">(</span><span class="operator">&</span><span class="keyword">mut</span> <span class="self_keyword declaration mutable">self</span><span class="parenthesis">)</span> <span class="brace">{</span> | 85 | <span class="keyword">fn</span> <span class="function associated declaration mutable">qux</span><span class="parenthesis">(</span><span class="operator">&</span><span class="keyword">mut</span> <span class="self_keyword declaration mutable">self</span><span class="parenthesis">)</span> <span class="brace">{</span> |
86 | <span class="self_keyword mutable">self</span><span class="operator">.</span><span class="field">x</span> <span class="operator">=</span> <span class="numeric_literal">0</span><span class="semicolon">;</span> | 86 | <span class="self_keyword mutable">self</span><span class="operator">.</span><span class="field public">x</span> <span class="operator">=</span> <span class="numeric_literal">0</span><span class="semicolon">;</span> |
87 | <span class="brace">}</span> | 87 | <span class="brace">}</span> |
88 | 88 | ||
89 | <span class="keyword">fn</span> <span class="function associated declaration">quop</span><span class="parenthesis">(</span><span class="operator">&</span><span class="self_keyword declaration">self</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">i32</span> <span class="brace">{</span> | 89 | <span class="keyword">fn</span> <span class="function associated declaration">quop</span><span class="parenthesis">(</span><span class="operator">&</span><span class="self_keyword declaration">self</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">i32</span> <span class="brace">{</span> |
90 | <span class="self_keyword">self</span><span class="operator">.</span><span class="field">x</span> | 90 | <span class="self_keyword">self</span><span class="operator">.</span><span class="field public">x</span> |
91 | <span class="brace">}</span> | 91 | <span class="brace">}</span> |
92 | <span class="brace">}</span> | 92 | <span class="brace">}</span> |
93 | 93 | ||
@@ -128,8 +128,8 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
128 | <span class="const_param">FOO</span> | 128 | <span class="const_param">FOO</span> |
129 | <span class="brace">}</span> | 129 | <span class="brace">}</span> |
130 | 130 | ||
131 | <span class="keyword">use</span> <span class="module">ops</span><span class="operator">::</span><span class="trait">Fn</span><span class="semicolon">;</span> | 131 | <span class="keyword">use</span> <span class="module public">ops</span><span class="operator">::</span><span class="trait public">Fn</span><span class="semicolon">;</span> |
132 | <span class="keyword">fn</span> <span class="function declaration">baz</span><span class="angle"><</span><span class="type_param declaration">F</span><span class="colon">:</span> <span class="trait">Fn</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="parenthesis">(</span><span class="parenthesis">)</span><span class="angle">></span><span class="parenthesis">(</span><span class="value_param callable declaration">f</span><span class="colon">:</span> <span class="type_param">F</span><span class="parenthesis">)</span> <span class="brace">{</span> | 132 | <span class="keyword">fn</span> <span class="function declaration">baz</span><span class="angle"><</span><span class="type_param declaration">F</span><span class="colon">:</span> <span class="trait public">Fn</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="parenthesis">(</span><span class="parenthesis">)</span><span class="angle">></span><span class="parenthesis">(</span><span class="value_param callable declaration">f</span><span class="colon">:</span> <span class="type_param">F</span><span class="parenthesis">)</span> <span class="brace">{</span> |
133 | <span class="value_param callable">f</span><span class="parenthesis">(</span><span class="parenthesis">)</span> | 133 | <span class="value_param callable">f</span><span class="parenthesis">(</span><span class="parenthesis">)</span> |
134 | <span class="brace">}</span> | 134 | <span class="brace">}</span> |
135 | 135 | ||
@@ -181,7 +181,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
181 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">vec</span> <span class="operator">=</span> <span class="unresolved_reference">Vec</span><span class="operator">::</span><span class="unresolved_reference">new</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> | 181 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">vec</span> <span class="operator">=</span> <span class="unresolved_reference">Vec</span><span class="operator">::</span><span class="unresolved_reference">new</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> |
182 | <span class="keyword control">if</span> <span class="bool_literal">true</span> <span class="brace">{</span> | 182 | <span class="keyword control">if</span> <span class="bool_literal">true</span> <span class="brace">{</span> |
183 | <span class="keyword">let</span> <span class="variable declaration">x</span> <span class="operator">=</span> <span class="numeric_literal">92</span><span class="semicolon">;</span> | 183 | <span class="keyword">let</span> <span class="variable declaration">x</span> <span class="operator">=</span> <span class="numeric_literal">92</span><span class="semicolon">;</span> |
184 | <span class="variable mutable">vec</span><span class="operator">.</span><span class="unresolved_reference">push</span><span class="parenthesis">(</span><span class="struct">Foo</span> <span class="brace">{</span> <span class="field">x</span><span class="comma">,</span> <span class="field">y</span><span class="colon">:</span> <span class="numeric_literal">1</span> <span class="brace">}</span><span class="parenthesis">)</span><span class="semicolon">;</span> | 184 | <span class="variable mutable">vec</span><span class="operator">.</span><span class="unresolved_reference">push</span><span class="parenthesis">(</span><span class="struct">Foo</span> <span class="brace">{</span> <span class="field">x</span><span class="comma">,</span> <span class="field public">y</span><span class="colon">:</span> <span class="numeric_literal">1</span> <span class="brace">}</span><span class="parenthesis">)</span><span class="semicolon">;</span> |
185 | <span class="brace">}</span> | 185 | <span class="brace">}</span> |
186 | <span class="keyword unsafe">unsafe</span> <span class="brace">{</span> | 186 | <span class="keyword unsafe">unsafe</span> <span class="brace">{</span> |
187 | <span class="variable mutable">vec</span><span class="operator">.</span><span class="unresolved_reference">set_len</span><span class="parenthesis">(</span><span class="numeric_literal">0</span><span class="parenthesis">)</span><span class="semicolon">;</span> | 187 | <span class="variable mutable">vec</span><span class="operator">.</span><span class="unresolved_reference">set_len</span><span class="parenthesis">(</span><span class="numeric_literal">0</span><span class="parenthesis">)</span><span class="semicolon">;</span> |
@@ -198,12 +198,12 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
198 | <span class="keyword">let</span> <span class="variable declaration mutable">y</span> <span class="operator">=</span> <span class="operator">&</span><span class="keyword">mut</span> <span class="variable mutable">x</span><span class="semicolon">;</span> | 198 | <span class="keyword">let</span> <span class="variable declaration mutable">y</span> <span class="operator">=</span> <span class="operator">&</span><span class="keyword">mut</span> <span class="variable mutable">x</span><span class="semicolon">;</span> |
199 | <span class="keyword">let</span> <span class="variable declaration">z</span> <span class="operator">=</span> <span class="operator">&</span><span class="variable mutable">y</span><span class="semicolon">;</span> | 199 | <span class="keyword">let</span> <span class="variable declaration">z</span> <span class="operator">=</span> <span class="operator">&</span><span class="variable mutable">y</span><span class="semicolon">;</span> |
200 | 200 | ||
201 | <span class="keyword">let</span> <span class="struct">Foo</span> <span class="brace">{</span> <span class="field">x</span><span class="colon">:</span> <span class="variable declaration">z</span><span class="comma">,</span> <span class="field">y</span> <span class="brace">}</span> <span class="operator">=</span> <span class="struct">Foo</span> <span class="brace">{</span> <span class="field">x</span><span class="colon">:</span> <span class="variable">z</span><span class="comma">,</span> <span class="field">y</span> <span class="brace">}</span><span class="semicolon">;</span> | 201 | <span class="keyword">let</span> <span class="struct">Foo</span> <span class="brace">{</span> <span class="field public">x</span><span class="colon">:</span> <span class="variable declaration">z</span><span class="comma">,</span> <span class="field">y</span> <span class="brace">}</span> <span class="operator">=</span> <span class="struct">Foo</span> <span class="brace">{</span> <span class="field public">x</span><span class="colon">:</span> <span class="variable">z</span><span class="comma">,</span> <span class="field">y</span> <span class="brace">}</span><span class="semicolon">;</span> |
202 | 202 | ||
203 | <span class="variable">y</span><span class="semicolon">;</span> | 203 | <span class="variable">y</span><span class="semicolon">;</span> |
204 | 204 | ||
205 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">foo</span> <span class="operator">=</span> <span class="struct">Foo</span> <span class="brace">{</span> <span class="field">x</span><span class="comma">,</span> <span class="field">y</span><span class="colon">:</span> <span class="variable mutable">x</span> <span class="brace">}</span><span class="semicolon">;</span> | 205 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">foo</span> <span class="operator">=</span> <span class="struct">Foo</span> <span class="brace">{</span> <span class="field">x</span><span class="comma">,</span> <span class="field public">y</span><span class="colon">:</span> <span class="variable mutable">x</span> <span class="brace">}</span><span class="semicolon">;</span> |
206 | <span class="keyword">let</span> <span class="variable declaration">foo2</span> <span class="operator">=</span> <span class="struct">Foo</span> <span class="brace">{</span> <span class="field">x</span><span class="comma">,</span> <span class="field">y</span><span class="colon">:</span> <span class="variable mutable">x</span> <span class="brace">}</span><span class="semicolon">;</span> | 206 | <span class="keyword">let</span> <span class="variable declaration">foo2</span> <span class="operator">=</span> <span class="struct">Foo</span> <span class="brace">{</span> <span class="field">x</span><span class="comma">,</span> <span class="field public">y</span><span class="colon">:</span> <span class="variable mutable">x</span> <span class="brace">}</span><span class="semicolon">;</span> |
207 | <span class="variable mutable">foo</span><span class="operator">.</span><span class="function associated">quop</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> | 207 | <span class="variable mutable">foo</span><span class="operator">.</span><span class="function associated">quop</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> |
208 | <span class="variable mutable">foo</span><span class="operator">.</span><span class="function associated mutable">qux</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> | 208 | <span class="variable mutable">foo</span><span class="operator">.</span><span class="function associated mutable">qux</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> |
209 | <span class="variable mutable">foo</span><span class="operator">.</span><span class="function associated consuming">baz</span><span class="parenthesis">(</span><span class="variable consuming">foo2</span><span class="parenthesis">)</span><span class="semicolon">;</span> | 209 | <span class="variable mutable">foo</span><span class="operator">.</span><span class="function associated consuming">baz</span><span class="parenthesis">(</span><span class="variable consuming">foo2</span><span class="parenthesis">)</span><span class="semicolon">;</span> |
@@ -269,5 +269,13 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
269 | <span class="brace">}</span> | 269 | <span class="brace">}</span> |
270 | <span class="brace">}</span> | 270 | <span class="brace">}</span> |
271 | 271 | ||
272 | <span class="keyword">pub</span> <span class="keyword">enum</span> <span class="enum declaration public">Bool</span> <span class="brace">{</span> <span class="enum_variant declaration public">True</span><span class="comma">,</span> <span class="enum_variant declaration public">False</span> <span class="brace">}</span> | ||
273 | |||
274 | <span class="keyword">impl</span> <span class="enum public">Bool</span> <span class="brace">{</span> | ||
275 | <span class="keyword">pub</span> <span class="keyword">const</span> <span class="keyword">fn</span> <span class="function associated declaration public">to_primitive</span><span class="parenthesis">(</span><span class="self_keyword declaration">self</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">bool</span> <span class="brace">{</span> | ||
276 | <span class="macro">matches!</span><span class="parenthesis">(</span>self<span class="comma">,</span> Self<span class="colon">:</span><span class="colon">:</span>True<span class="parenthesis">)</span> | ||
277 | <span class="brace">}</span> | ||
278 | <span class="brace">}</span> | ||
279 | <span class="keyword">const</span> <span class="constant declaration">USAGE_OF_BOOL</span><span class="colon">:</span><span class="builtin_type">bool</span> <span class="operator">=</span> <span class="enum public">Bool</span><span class="operator">::</span><span class="enum_variant public">True</span><span class="operator">.</span><span class="function associated consuming public">to_primitive</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> | ||
272 | 280 | ||
273 | </code></pre> \ No newline at end of file | 281 | </code></pre> \ No newline at end of file |
diff --git a/crates/ide/src/syntax_highlighting/tests.rs b/crates/ide/src/syntax_highlighting/tests.rs index 4f0b1ce85..502a88af2 100644 --- a/crates/ide/src/syntax_highlighting/tests.rs +++ b/crates/ide/src/syntax_highlighting/tests.rs | |||
@@ -242,6 +242,14 @@ fn use_foo_items() { | |||
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 | ||
245 | pub enum Bool { True, False } | ||
246 | |||
247 | impl Bool { | ||
248 | pub const fn to_primitive(self) -> bool { | ||
249 | matches!(self, Self::True) | ||
250 | } | ||
251 | } | ||
252 | const USAGE_OF_BOOL:bool = Bool::True.to_primitive(); | ||
245 | 253 | ||
246 | //- /foo.rs crate:foo | 254 | //- /foo.rs crate:foo |
247 | pub struct Person { | 255 | pub struct Person { |
@@ -390,7 +398,7 @@ struct Foo { | |||
390 | .highlight_range(FileRange { file_id, range: TextRange::at(45.into(), 1.into()) }) | 398 | .highlight_range(FileRange { file_id, range: TextRange::at(45.into(), 1.into()) }) |
391 | .unwrap(); | 399 | .unwrap(); |
392 | 400 | ||
393 | assert_eq!(&highlights[0].highlight.to_string(), "field.declaration"); | 401 | assert_eq!(&highlights[0].highlight.to_string(), "field.declaration.public"); |
394 | } | 402 | } |
395 | 403 | ||
396 | #[test] | 404 | #[test] |
diff --git a/crates/rust-analyzer/src/semantic_tokens.rs b/crates/rust-analyzer/src/semantic_tokens.rs index c20642231..3f6c52e91 100644 --- a/crates/rust-analyzer/src/semantic_tokens.rs +++ b/crates/rust-analyzer/src/semantic_tokens.rs | |||
@@ -93,6 +93,7 @@ define_semantic_token_modifiers![ | |||
93 | (CONSUMING, "consuming"), | 93 | (CONSUMING, "consuming"), |
94 | (ASYNC, "async"), | 94 | (ASYNC, "async"), |
95 | (LIBRARY, "library"), | 95 | (LIBRARY, "library"), |
96 | (PUBLIC, "public"), | ||
96 | (UNSAFE, "unsafe"), | 97 | (UNSAFE, "unsafe"), |
97 | (ATTRIBUTE_MODIFIER, "attribute"), | 98 | (ATTRIBUTE_MODIFIER, "attribute"), |
98 | (TRAIT_MODIFIER, "trait"), | 99 | (TRAIT_MODIFIER, "trait"), |
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index 310d8c6d2..f9497f76f 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs | |||
@@ -505,6 +505,7 @@ fn semantic_token_type_and_modifiers( | |||
505 | HlMod::Consuming => semantic_tokens::CONSUMING, | 505 | HlMod::Consuming => semantic_tokens::CONSUMING, |
506 | HlMod::Async => semantic_tokens::ASYNC, | 506 | HlMod::Async => semantic_tokens::ASYNC, |
507 | HlMod::Library => semantic_tokens::LIBRARY, | 507 | HlMod::Library => semantic_tokens::LIBRARY, |
508 | HlMod::Public => semantic_tokens::PUBLIC, | ||
508 | HlMod::Unsafe => semantic_tokens::UNSAFE, | 509 | HlMod::Unsafe => semantic_tokens::UNSAFE, |
509 | HlMod::Callable => semantic_tokens::CALLABLE, | 510 | HlMod::Callable => semantic_tokens::CALLABLE, |
510 | HlMod::Static => lsp_types::SemanticTokenModifier::STATIC, | 511 | HlMod::Static => lsp_types::SemanticTokenModifier::STATIC, |