diff options
author | Aleksey Kladov <[email protected]> | 2021-01-09 12:18:49 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-01-09 12:38:32 +0000 |
commit | d4fb7476efc8bf956c56ba2b0e946f48f38a6efc (patch) | |
tree | 43f190a26a4a8ed68fa28bbd234ca977a2f6dd6a /crates/ide/src/syntax_highlighting/injection.rs | |
parent | 8a0bd500363fd2953c2a469083b00be54c602ebb (diff) |
Better names
Diffstat (limited to 'crates/ide/src/syntax_highlighting/injection.rs')
-rw-r--r-- | crates/ide/src/syntax_highlighting/injection.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/crates/ide/src/syntax_highlighting/injection.rs b/crates/ide/src/syntax_highlighting/injection.rs index 13dde1dc4..22d7f601a 100644 --- a/crates/ide/src/syntax_highlighting/injection.rs +++ b/crates/ide/src/syntax_highlighting/injection.rs | |||
@@ -12,7 +12,7 @@ use crate::{Analysis, HlMod, HlRange, HlTag, RootDatabase}; | |||
12 | use super::{highlights::Highlights, injector::Injector}; | 12 | use super::{highlights::Highlights, injector::Injector}; |
13 | 13 | ||
14 | pub(super) fn highlight_injection( | 14 | pub(super) fn highlight_injection( |
15 | acc: &mut Highlights, | 15 | hl: &mut Highlights, |
16 | sema: &Semantics<RootDatabase>, | 16 | sema: &Semantics<RootDatabase>, |
17 | literal: ast::String, | 17 | literal: ast::String, |
18 | expanded: SyntaxToken, | 18 | expanded: SyntaxToken, |
@@ -21,24 +21,25 @@ pub(super) fn highlight_injection( | |||
21 | if !active_parameter.name.starts_with("ra_fixture") { | 21 | if !active_parameter.name.starts_with("ra_fixture") { |
22 | return None; | 22 | return None; |
23 | } | 23 | } |
24 | |||
24 | let value = literal.value()?; | 25 | let value = literal.value()?; |
25 | let marker_info = MarkerInfo::new(&*value); | 26 | let marker_info = MarkerInfo::new(&*value); |
26 | let (analysis, tmp_file_id) = Analysis::from_single_file(marker_info.cleaned_text.clone()); | 27 | let (analysis, tmp_file_id) = Analysis::from_single_file(marker_info.cleaned_text.clone()); |
27 | 28 | ||
28 | if let Some(range) = literal.open_quote_text_range() { | 29 | if let Some(range) = literal.open_quote_text_range() { |
29 | acc.add(HlRange { range, highlight: HlTag::StringLiteral.into(), binding_hash: None }) | 30 | hl.add(HlRange { range, highlight: HlTag::StringLiteral.into(), binding_hash: None }) |
30 | } | 31 | } |
31 | 32 | ||
32 | for mut h in analysis.highlight(tmp_file_id).unwrap() { | 33 | for mut hl_range in analysis.highlight(tmp_file_id).unwrap() { |
33 | let range = marker_info.map_range_up(h.range); | 34 | let range = marker_info.map_range_up(hl_range.range); |
34 | if let Some(range) = literal.map_range_up(range) { | 35 | if let Some(range) = literal.map_range_up(range) { |
35 | h.range = range; | 36 | hl_range.range = range; |
36 | acc.add(h); | 37 | hl.add(hl_range); |
37 | } | 38 | } |
38 | } | 39 | } |
39 | 40 | ||
40 | if let Some(range) = literal.close_quote_text_range() { | 41 | if let Some(range) = literal.close_quote_text_range() { |
41 | acc.add(HlRange { range, highlight: HlTag::StringLiteral.into(), binding_hash: None }) | 42 | hl.add(HlRange { range, highlight: HlTag::StringLiteral.into(), binding_hash: None }) |
42 | } | 43 | } |
43 | 44 | ||
44 | Some(()) | 45 | Some(()) |