Ensure all existing doctest code highlights have documentation modifier

This commit is contained in:
Paul Daniel Faria
2020-06-17 09:33:21 -04:00
parent aae26bc5b8
commit a951108173
3 changed files with 22 additions and 21 deletions

View File

@@ -8,8 +8,8 @@ use ra_syntax::{ast, AstToken, SyntaxNode, SyntaxToken, TextRange, TextSize};
use stdx::SepBy;
use crate::{
call_info::ActiveParameter, Analysis, Highlight, HighlightModifier, HighlightTag,
HighlightedRange, RootDatabase,
call_info::ActiveParameter, Analysis, HighlightModifier, HighlightTag, HighlightedRange,
RootDatabase,
};
use super::HighlightedRangeStack;
@@ -121,8 +121,7 @@ pub(super) fn extract_doc_comments(
range.start(),
range.start() + TextSize::try_from(pos).unwrap(),
),
highlight: Highlight::from(HighlightTag::Comment)
| HighlightModifier::Documentation,
highlight: HighlightTag::Comment | HighlightModifier::Documentation,
binding_hash: None,
});
line_start += range.len() - TextSize::try_from(pos).unwrap();
@@ -168,6 +167,8 @@ pub(super) fn highlight_doc_comment(
h.range.start() + start_offset,
h.range.end() + end_offset.unwrap_or(start_offset),
);
h.highlight |= HighlightModifier::Documentation;
stack.add(h);
}
}