Syntactic highlighting of NAME_REF for injections
This commit adds a function that tries to determine the syntax highlighting class of NAME_REFs based on the usage. It is used for highlighting injections (such as highlighting of doctests) as the semantic logic will most of the time result in unresolved references. It also adds a color to unresolved references in HTML encoding.
This commit is contained in:
@@ -440,12 +440,14 @@ impl Analysis {
|
||||
|
||||
/// Computes syntax highlighting for the given file
|
||||
pub fn highlight(&self, file_id: FileId) -> Cancelable<Vec<HighlightedRange>> {
|
||||
self.with_db(|db| syntax_highlighting::highlight(db, file_id, None))
|
||||
self.with_db(|db| syntax_highlighting::highlight(db, file_id, None, false))
|
||||
}
|
||||
|
||||
/// Computes syntax highlighting for the given file range.
|
||||
pub fn highlight_range(&self, frange: FileRange) -> Cancelable<Vec<HighlightedRange>> {
|
||||
self.with_db(|db| syntax_highlighting::highlight(db, frange.file_id, Some(frange.range)))
|
||||
self.with_db(|db| {
|
||||
syntax_highlighting::highlight(db, frange.file_id, Some(frange.range), false)
|
||||
})
|
||||
}
|
||||
|
||||
/// Computes syntax highlighting for the given file.
|
||||
|
||||
Reference in New Issue
Block a user