Skip to content

Commit 8e9ccbf

Browse files
bors[bot]jhgg
andauthored
Merge #11177
11177: internal: dont descend into comments r=Veykril a=jhgg fixes #11176 Co-authored-by: Jake Heinz <jh@discordapp.com>
2 parents abbc7e3 + 04decd5 commit 8e9ccbf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

crates/ide/src/syntax_highlighting.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,10 @@ fn traverse(
282282

283283
// only attempt to descend if we are inside a macro call or attribute
284284
// as calling `descend_into_macros_single` gets rather expensive if done for every single token
285-
let descend_token = current_macro_call.is_some() || current_attr_call.is_some();
285+
// additionally, do not descend into comments, descending maps down to doc attributes which get
286+
// tagged as string literals.
287+
let descend_token = (current_macro_call.is_some() || current_attr_call.is_some())
288+
&& element.kind() != COMMENT;
286289
let element_to_highlight = if descend_token {
287290
let token = match &element {
288291
NodeOrToken::Node(_) => continue,

0 commit comments

Comments
 (0)