diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-06-16 12:40:51 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-06-16 12:40:51 +0100 |
commit | 4342b717158eeb9aff20d1958229ffcbca17f1c7 (patch) | |
tree | ddcbbfe6fcaaac83449fe612c971044e19680365 /crates/ra_ide/src/syntax_highlighting/injection.rs | |
parent | 83a16e825da2767aaee1d62447eb94f4d7de8881 (diff) | |
parent | c4b3db0c2f307d1d782af88ded260e4c6593cae0 (diff) |
Merge #4876
4876: Syntactic highlighting of NAME_REF for injections r=matklad a=ltentrup
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.
Follow up of #4683.
Fixes #4809.
Co-authored-by: Leander Tentrup <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/syntax_highlighting/injection.rs')
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting/injection.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting/injection.rs b/crates/ra_ide/src/syntax_highlighting/injection.rs index 3575a0fc6..a02ffe59e 100644 --- a/crates/ra_ide/src/syntax_highlighting/injection.rs +++ b/crates/ra_ide/src/syntax_highlighting/injection.rs | |||
@@ -137,7 +137,7 @@ pub(super) fn highlight_doc_comment( | |||
137 | let (analysis, tmp_file_id) = Analysis::from_single_file(text); | 137 | let (analysis, tmp_file_id) = Analysis::from_single_file(text); |
138 | 138 | ||
139 | stack.push(); | 139 | stack.push(); |
140 | for mut h in analysis.highlight(tmp_file_id).unwrap() { | 140 | for mut h in analysis.with_db(|db| super::highlight(db, tmp_file_id, None, true)).unwrap() { |
141 | // Determine start offset and end offset in case of multi-line ranges | 141 | // Determine start offset and end offset in case of multi-line ranges |
142 | let mut start_offset = None; | 142 | let mut start_offset = None; |
143 | let mut end_offset = None; | 143 | let mut end_offset = None; |