mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-20 02:47:34 +03:00
Avoid spurious highlight runs in Language::highlight_text
This commit is contained in:
parent
d330f909e6
commit
03d7035630
@ -51,6 +51,10 @@ impl HighlightMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl HighlightId {
|
impl HighlightId {
|
||||||
|
pub fn is_default(&self) -> bool {
|
||||||
|
*self == DEFAULT_SYNTAX_HIGHLIGHT_ID
|
||||||
|
}
|
||||||
|
|
||||||
pub fn style(&self, theme: &SyntaxTheme) -> Option<HighlightStyle> {
|
pub fn style(&self, theme: &SyntaxTheme) -> Option<HighlightStyle> {
|
||||||
theme
|
theme
|
||||||
.highlights
|
.highlights
|
||||||
|
@ -546,7 +546,9 @@ impl Language {
|
|||||||
{
|
{
|
||||||
let end_offset = offset + chunk.text.len();
|
let end_offset = offset + chunk.text.len();
|
||||||
if let Some(highlight_id) = chunk.syntax_highlight_id {
|
if let Some(highlight_id) = chunk.syntax_highlight_id {
|
||||||
result.push((offset..end_offset, highlight_id));
|
if !highlight_id.is_default() {
|
||||||
|
result.push((offset..end_offset, highlight_id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
offset = end_offset;
|
offset = end_offset;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user