aboutsummaryrefslogtreecommitdiff
path: root/crates/ide
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-06-09 14:02:11 +0100
committerLukas Wirth <[email protected]>2021-06-09 14:02:11 +0100
commit3c40b15d625df192eb17c34f15f7dbc23f5284b9 (patch)
treef3fd6dd1072a5a8bdd7145c0f1fc3258752badb2 /crates/ide
parent590472607c9629fdd37e3f6f33dacfdc2a3f56cc (diff)
Don't descend MacroCall TokenTree delimiters
Diffstat (limited to 'crates/ide')
-rw-r--r--crates/ide/src/syntax_highlighting/test_data/highlighting.html5
-rw-r--r--crates/ide/src/syntax_highlighting/tests.rs5
2 files changed, 10 insertions, 0 deletions
diff --git a/crates/ide/src/syntax_highlighting/test_data/highlighting.html b/crates/ide/src/syntax_highlighting/test_data/highlighting.html
index 0264e39a3..a7b5c3b89 100644
--- a/crates/ide/src/syntax_highlighting/test_data/highlighting.html
+++ b/crates/ide/src/syntax_highlighting/test_data/highlighting.html
@@ -148,6 +148,10 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
148 <span class="brace">}</span> 148 <span class="brace">}</span>
149<span class="brace">}</span> 149<span class="brace">}</span>
150 150
151<span class="keyword">macro_rules</span><span class="punctuation">!</span> <span class="macro declaration">dont_color_me_braces</span> <span class="brace">{</span>
152 <span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="operator">=</span><span class="angle">&gt;</span> <span class="brace">{</span><span class="numeric_literal">0</span><span class="brace">}</span>
153<span class="brace">}</span>
154
151<span class="keyword">macro_rules</span><span class="punctuation">!</span> <span class="macro declaration">noop</span> <span class="brace">{</span> 155<span class="keyword">macro_rules</span><span class="punctuation">!</span> <span class="macro declaration">noop</span> <span class="brace">{</span>
152 <span class="parenthesis">(</span><span class="punctuation">$</span>expr<span class="colon">:</span>expr<span class="parenthesis">)</span> <span class="operator">=</span><span class="angle">&gt;</span> <span class="brace">{</span> 156 <span class="parenthesis">(</span><span class="punctuation">$</span>expr<span class="colon">:</span>expr<span class="parenthesis">)</span> <span class="operator">=</span><span class="angle">&gt;</span> <span class="brace">{</span>
153 <span class="punctuation">$</span>expr 157 <span class="punctuation">$</span>expr
@@ -171,6 +175,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
171<span class="comment">// comment</span> 175<span class="comment">// comment</span>
172<span class="keyword">fn</span> <span class="function declaration">main</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span> 176<span class="keyword">fn</span> <span class="function declaration">main</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span>
173 <span class="macro">println!</span><span class="parenthesis">(</span><span class="string_literal">"Hello, {}!"</span><span class="comma">,</span> <span class="numeric_literal">92</span><span class="parenthesis">)</span><span class="semicolon">;</span> 177 <span class="macro">println!</span><span class="parenthesis">(</span><span class="string_literal">"Hello, {}!"</span><span class="comma">,</span> <span class="numeric_literal">92</span><span class="parenthesis">)</span><span class="semicolon">;</span>
178 <span class="macro">dont_color_me_braces!</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span>
174 179
175 <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> 180 <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>
176 <span class="keyword control">if</span> <span class="bool_literal">true</span> <span class="brace">{</span> 181 <span class="keyword control">if</span> <span class="bool_literal">true</span> <span class="brace">{</span>
diff --git a/crates/ide/src/syntax_highlighting/tests.rs b/crates/ide/src/syntax_highlighting/tests.rs
index 662b53481..6ad2a362a 100644
--- a/crates/ide/src/syntax_highlighting/tests.rs
+++ b/crates/ide/src/syntax_highlighting/tests.rs
@@ -122,6 +122,10 @@ def_fn! {
122 } 122 }
123} 123}
124 124
125macro_rules! dont_color_me_braces {
126 () => {0}
127}
128
125macro_rules! noop { 129macro_rules! noop {
126 ($expr:expr) => { 130 ($expr:expr) => {
127 $expr 131 $expr
@@ -145,6 +149,7 @@ macro without_args {
145// comment 149// comment
146fn main() { 150fn main() {
147 println!("Hello, {}!", 92); 151 println!("Hello, {}!", 92);
152 dont_color_me_braces!();
148 153
149 let mut vec = Vec::new(); 154 let mut vec = Vec::new();
150 if true { 155 if true {