Skip to content

Commit

Permalink
Highlight the entire covering_element's text range
Browse files Browse the repository at this point in the history
Instead of only highlighting the requested text_range we want to
highlight the text range of the covering element which might be greater
than the given text range. This is to prevent us from breaking the
assumption that the highlighted elements in a node are always contained
inside the root text range.
  • Loading branch information
Veykril committed Feb 1, 2021
1 parent 286d90d commit 97779e6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions crates/ide/src/syntax_highlighting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ pub(crate) fn highlight(
NodeOrToken::Node(it) => it,
NodeOrToken::Token(it) => it.parent(),
};
let range = node.text_range();
(node, range)
}
None => (source_file.syntax().clone(), source_file.syntax().text_range()),
Expand Down

0 comments on commit 97779e6

Please sign in to comment.