aboutsummaryrefslogtreecommitdiff
path: root/crates/ide
diff options
context:
space:
mode:
authorChetan Khilosiya <[email protected]>2021-04-05 20:22:00 +0100
committerChetan Khilosiya <[email protected]>2021-04-08 18:28:26 +0100
commitb232549653fa3477dec0585e7bdfe637d7aaf31e (patch)
treee2275269aea3fe322832fed39f4e7d13c4eb4bc3 /crates/ide
parent1735b3ef6a7c7f7b3f5cdecdbf204c85991bcd63 (diff)
8279: Fix the not operator use and test case fix.
Diffstat (limited to 'crates/ide')
-rw-r--r--crates/ide/src/syntax_highlighting/highlight.rs9
-rw-r--r--crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html2
-rw-r--r--crates/ide/src/syntax_highlighting/test_data/highlighting.html2
3 files changed, 3 insertions, 10 deletions
diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs
index 7734ea301..8dd5d801b 100644
--- a/crates/ide/src/syntax_highlighting/highlight.rs
+++ b/crates/ide/src/syntax_highlighting/highlight.rs
@@ -169,16 +169,13 @@ pub(super) fn element(
169 HlTag::Operator(HlOperator::Other).into() 169 HlTag::Operator(HlOperator::Other).into()
170 } 170 }
171 T![!] if element.parent().and_then(ast::MacroCall::cast).is_some() => { 171 T![!] if element.parent().and_then(ast::MacroCall::cast).is_some() => {
172 eprintln!("in macro call: {}", element);
173 HlTag::Symbol(SymbolKind::Macro).into() 172 HlTag::Symbol(SymbolKind::Macro).into()
174 } 173 }
175 T![!] if element.parent().and_then(ast::NeverType::cast).is_some() => { 174 T![!] if element.parent().and_then(ast::NeverType::cast).is_some() => {
176 eprintln!("in never type : {}", element);
177 HlTag::BuiltinType.into() 175 HlTag::BuiltinType.into()
178 } 176 }
179 T![!] if element.parent().and_then(ast::PrefixExpr::cast).is_some() => { 177 T![!] if element.parent().and_then(ast::PrefixExpr::cast).is_some() => {
180 eprintln!("pre expr for : {}", element); 178 HlTag::Operator(HlOperator::Logical).into()
181 HlTag::Operator(HlOperator::Bitwise).into()
182 } 179 }
183 T![*] if element.parent().and_then(ast::PtrType::cast).is_some() => { 180 T![*] if element.parent().and_then(ast::PtrType::cast).is_some() => {
184 HlTag::Keyword.into() 181 HlTag::Keyword.into()
@@ -197,7 +194,6 @@ pub(super) fn element(
197 } 194 }
198 } 195 }
199 T![-] if element.parent().and_then(ast::PrefixExpr::cast).is_some() => { 196 T![-] if element.parent().and_then(ast::PrefixExpr::cast).is_some() => {
200 eprintln!("the - operator: {}", element);
201 let prefix_expr = element.parent().and_then(ast::PrefixExpr::cast)?; 197 let prefix_expr = element.parent().and_then(ast::PrefixExpr::cast)?;
202 198
203 let expr = prefix_expr.expr()?; 199 let expr = prefix_expr.expr()?;
@@ -208,7 +204,6 @@ pub(super) fn element(
208 .into() 204 .into()
209 } 205 }
210 _ if element.parent().and_then(ast::PrefixExpr::cast).is_some() => { 206 _ if element.parent().and_then(ast::PrefixExpr::cast).is_some() => {
211 eprintln!("the prefix expr block: {}", element);
212 HlTag::Operator(HlOperator::Other).into() 207 HlTag::Operator(HlOperator::Other).into()
213 } 208 }
214 T![+] | T![-] | T![*] | T![/] | T![+=] | T![-=] | T![*=] | T![/=] 209 T![+] | T![-] | T![*] | T![/] | T![+=] | T![-=] | T![*=] | T![/=]
@@ -230,11 +225,9 @@ pub(super) fn element(
230 HlTag::Operator(HlOperator::Comparision).into() 225 HlTag::Operator(HlOperator::Comparision).into()
231 } 226 }
232 _ if element.parent().and_then(ast::BinExpr::cast).is_some() => { 227 _ if element.parent().and_then(ast::BinExpr::cast).is_some() => {
233 eprintln!("the bin expr : {}", element);
234 HlTag::Operator(HlOperator::Other).into() 228 HlTag::Operator(HlOperator::Other).into()
235 } 229 }
236 _ if element.parent().and_then(ast::RangeExpr::cast).is_some() => { 230 _ if element.parent().and_then(ast::RangeExpr::cast).is_some() => {
237 eprintln!("the range expr block: {}", element);
238 HlTag::Operator(HlOperator::Other).into() 231 HlTag::Operator(HlOperator::Other).into()
239 } 232 }
240 _ if element.parent().and_then(ast::RangePat::cast).is_some() => { 233 _ if element.parent().and_then(ast::RangePat::cast).is_some() => {
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 b6d1cac4e..6ee6d85fb 100644
--- a/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html
+++ b/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html
@@ -76,7 +76,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
76 <span class="comment documentation">/// </span><span class="comment injected">// calls bar on foo</span> 76 <span class="comment documentation">/// </span><span class="comment injected">// calls bar on foo</span>
77 <span class="comment documentation">/// </span><span class="macro injected">assert!</span><span class="parenthesis injected">(</span><span class="none injected">foo</span><span class="operator injected">.</span><span class="none injected">bar</span><span class="parenthesis injected">(</span><span class="parenthesis injected">)</span><span class="parenthesis injected">)</span><span class="semicolon injected">;</span> 77 <span class="comment documentation">/// </span><span class="macro injected">assert!</span><span class="parenthesis injected">(</span><span class="none injected">foo</span><span class="operator injected">.</span><span class="none injected">bar</span><span class="parenthesis injected">(</span><span class="parenthesis injected">)</span><span class="parenthesis injected">)</span><span class="semicolon injected">;</span>
78 <span class="comment documentation">///</span> 78 <span class="comment documentation">///</span>
79 <span class="comment documentation">/// </span><span class="keyword injected">let</span><span class="none injected"> </span><span class="variable declaration injected">bar</span><span class="none injected"> </span><span class="operator injected">=</span><span class="none injected"> </span><span class="variable injected">foo</span><span class="operator injected">.</span><span class="field injected">bar</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="constant injected">bar</span><span class="semicolon injected">;</span> 79 <span class="comment documentation">/// </span><span class="keyword injected">let</span><span class="none injected"> </span><span class="variable declaration injected">bar</span><span class="none injected"> </span><span class="operator injected">=</span><span class="none injected"> </span><span class="variable injected">foo</span><span class="operator injected">.</span><span class="field injected">bar</span><span class="none injected"> </span><span class="logical injected">||</span><span class="none injected"> </span><span class="struct injected">Foo</span><span class="operator injected">::</span><span class="constant injected">bar</span><span class="semicolon injected">;</span>
80 <span class="comment documentation">///</span> 80 <span class="comment documentation">///</span>
81 <span class="comment documentation">/// </span><span class="comment injected">/* multi-line</span> 81 <span class="comment documentation">/// </span><span class="comment injected">/* multi-line</span>
82 <span class="comment documentation">/// </span><span class="comment injected"> comment */</span> 82 <span class="comment documentation">/// </span><span class="comment injected"> comment */</span>
diff --git a/crates/ide/src/syntax_highlighting/test_data/highlighting.html b/crates/ide/src/syntax_highlighting/test_data/highlighting.html
index 973173254..c43bcb691 100644
--- a/crates/ide/src/syntax_highlighting/test_data/highlighting.html
+++ b/crates/ide/src/syntax_highlighting/test_data/highlighting.html
@@ -213,7 +213,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
213 <span class="keyword">let</span> <span class="variable declaration">baz</span> <span class="operator">=</span> <span class="numeric_literal">-</span><span class="numeric_literal">42</span><span class="semicolon">;</span> 213 <span class="keyword">let</span> <span class="variable declaration">baz</span> <span class="operator">=</span> <span class="numeric_literal">-</span><span class="numeric_literal">42</span><span class="semicolon">;</span>
214 <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="semicolon">;</span> 214 <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="semicolon">;</span>
215 215
216 <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="semicolon">;</span> 216 <span class="keyword">let</span> <span class="punctuation">_</span> <span class="operator">=</span> <span class="logical">!</span><span class="bool_literal">true</span><span class="semicolon">;</span>
217 217
218 <span class="label declaration">'foo</span><span class="colon">:</span> <span class="keyword control">loop</span> <span class="brace">{</span> 218 <span class="label declaration">'foo</span><span class="colon">:</span> <span class="keyword control">loop</span> <span class="brace">{</span>
219 <span class="keyword control">break</span> <span class="label">'foo</span><span class="semicolon">;</span> 219 <span class="keyword control">break</span> <span class="label">'foo</span><span class="semicolon">;</span>