diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-05-25 03:30:47 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-25 03:30:47 +0100 |
commit | 8b049ec393230e4b9fea3022a3ebf34e2af5395d (patch) | |
tree | d75b9290e907898027eab2e723ed1c0040e43e4e /crates/ide/src/syntax_highlighting.rs | |
parent | 6d473c0a8f6acecbae680b69528b3f88a31dc5fc (diff) | |
parent | d75277b66b07e3fa4fed5088b92c6f65b2de8fe9 (diff) |
Merge #8942
8942: Add `library` semantic token modifier to items from other crates r=arzg a=arzg
Closes #5772.
A lot of code here is pretty repetitive; please let me know if you have any ideas how to improve it, or whether it’s fine as-is.
Side-note: How can I add tests for this? I don’t see a way for the test Rust code in `test_highlighting` to reference other crates to observe the new behaviour.
Co-authored-by: Aramis Razzaghipour <[email protected]>
Diffstat (limited to 'crates/ide/src/syntax_highlighting.rs')
-rw-r--r-- | crates/ide/src/syntax_highlighting.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index 9df8d21af..cf1a8bad7 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs | |||
@@ -80,6 +80,7 @@ pub(crate) fn highlight( | |||
80 | &mut hl, | 80 | &mut hl, |
81 | &sema, | 81 | &sema, |
82 | InFile::new(file_id.into(), &root), | 82 | InFile::new(file_id.into(), &root), |
83 | sema.scope(&root).krate(), | ||
83 | range_to_highlight, | 84 | range_to_highlight, |
84 | syntactic_name_ref_highlighting, | 85 | syntactic_name_ref_highlighting, |
85 | ); | 86 | ); |
@@ -90,6 +91,7 @@ fn traverse( | |||
90 | hl: &mut Highlights, | 91 | hl: &mut Highlights, |
91 | sema: &Semantics<RootDatabase>, | 92 | sema: &Semantics<RootDatabase>, |
92 | root: InFile<&SyntaxNode>, | 93 | root: InFile<&SyntaxNode>, |
94 | krate: Option<hir::Crate>, | ||
93 | range_to_highlight: TextRange, | 95 | range_to_highlight: TextRange, |
94 | syntactic_name_ref_highlighting: bool, | 96 | syntactic_name_ref_highlighting: bool, |
95 | ) { | 97 | ) { |
@@ -209,6 +211,7 @@ fn traverse( | |||
209 | 211 | ||
210 | if let Some((mut highlight, binding_hash)) = highlight::element( | 212 | if let Some((mut highlight, binding_hash)) = highlight::element( |
211 | &sema, | 213 | &sema, |
214 | krate, | ||
212 | &mut bindings_shadow_count, | 215 | &mut bindings_shadow_count, |
213 | syntactic_name_ref_highlighting, | 216 | syntactic_name_ref_highlighting, |
214 | element_to_highlight.clone(), | 217 | element_to_highlight.clone(), |