aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/syntax_highlighting.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-07-20 10:58:27 +0100
committerAleksey Kladov <[email protected]>2019-07-20 10:58:27 +0100
commitf3bdbec1b68fa0e20f0b7b6c6ef64e1507970b0d (patch)
treef2cb82f74d2d60d5351c3d7c4d8e7bce4d351cab /crates/ra_ide_api/src/syntax_highlighting.rs
parent6d5d82e412dea19ea48eecc6f7d5a4aa223a9599 (diff)
rename range -> text_range
Diffstat (limited to 'crates/ra_ide_api/src/syntax_highlighting.rs')
-rw-r--r--crates/ra_ide_api/src/syntax_highlighting.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_ide_api/src/syntax_highlighting.rs b/crates/ra_ide_api/src/syntax_highlighting.rs
index 477827fa7..878a94f06 100644
--- a/crates/ra_ide_api/src/syntax_highlighting.rs
+++ b/crates/ra_ide_api/src/syntax_highlighting.rs
@@ -189,11 +189,11 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
189 if let Some(segment) = path.segment() { 189 if let Some(segment) = path.segment() {
190 if let Some(name_ref) = segment.name_ref() { 190 if let Some(name_ref) = segment.name_ref() {
191 highlighted.insert(name_ref.syntax().clone().into()); 191 highlighted.insert(name_ref.syntax().clone().into());
192 let range_start = name_ref.syntax().range().start(); 192 let range_start = name_ref.syntax().text_range().start();
193 let mut range_end = name_ref.syntax().range().end(); 193 let mut range_end = name_ref.syntax().text_range().end();
194 for sibling in path.syntax().siblings_with_tokens(Direction::Next) { 194 for sibling in path.syntax().siblings_with_tokens(Direction::Next) {
195 match sibling.kind() { 195 match sibling.kind() {
196 T![!] | IDENT => range_end = sibling.range().end(), 196 T![!] | IDENT => range_end = sibling.text_range().end(),
197 _ => (), 197 _ => (),
198 } 198 }
199 } 199 }
@@ -209,7 +209,7 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
209 continue; 209 continue;
210 } 210 }
211 }; 211 };
212 res.push(HighlightedRange { range: node.range(), tag, binding_hash }) 212 res.push(HighlightedRange { range: node.text_range(), tag, binding_hash })
213 } 213 }
214 res 214 res
215} 215}
@@ -239,9 +239,9 @@ pub(crate) fn highlight_as_html(db: &RootDatabase, file_id: FileId, rainbow: boo
239 buf.push_str("<pre><code>"); 239 buf.push_str("<pre><code>");
240 let tokens = parse.tree().syntax().descendants_with_tokens().filter_map(|it| it.into_token()); 240 let tokens = parse.tree().syntax().descendants_with_tokens().filter_map(|it| it.into_token());
241 for token in tokens { 241 for token in tokens {
242 could_intersect.retain(|it| token.range().start() <= it.range.end()); 242 could_intersect.retain(|it| token.text_range().start() <= it.range.end());
243 while let Some(r) = ranges.get(frontier) { 243 while let Some(r) = ranges.get(frontier) {
244 if r.range.start() <= token.range().end() { 244 if r.range.start() <= token.text_range().end() {
245 could_intersect.push(r); 245 could_intersect.push(r);
246 frontier += 1; 246 frontier += 1;
247 } else { 247 } else {
@@ -251,7 +251,7 @@ pub(crate) fn highlight_as_html(db: &RootDatabase, file_id: FileId, rainbow: boo
251 let text = html_escape(&token.text()); 251 let text = html_escape(&token.text());
252 let ranges = could_intersect 252 let ranges = could_intersect
253 .iter() 253 .iter()
254 .filter(|it| token.range().is_subrange(&it.range)) 254 .filter(|it| token.text_range().is_subrange(&it.range))
255 .collect::<Vec<_>>(); 255 .collect::<Vec<_>>();
256 if ranges.is_empty() { 256 if ranges.is_empty() {
257 buf.push_str(&text); 257 buf.push_str(&text);