diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-01-07 16:11:54 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-07 16:11:54 +0000 |
commit | 344704a054fe3cf9c54893c2bfa0ec6ebbabf692 (patch) | |
tree | 5f0063b4d3b5b7f78a76d375f4237763bdd82221 /crates/base_db/src/fixture.rs | |
parent | b821264f861be959709aa0e7e87b4c5e1ce335b5 (diff) | |
parent | f459375f4873d601b6a0e2c3c5d29be569b3e067 (diff) |
Merge #7196
7196: Better fixture highlight r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/base_db/src/fixture.rs')
-rw-r--r-- | crates/base_db/src/fixture.rs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/crates/base_db/src/fixture.rs b/crates/base_db/src/fixture.rs index 66e6443cb..98acd61b1 100644 --- a/crates/base_db/src/fixture.rs +++ b/crates/base_db/src/fixture.rs | |||
@@ -61,7 +61,9 @@ use std::{str::FromStr, sync::Arc}; | |||
61 | 61 | ||
62 | use cfg::CfgOptions; | 62 | use cfg::CfgOptions; |
63 | use rustc_hash::FxHashMap; | 63 | use rustc_hash::FxHashMap; |
64 | use test_utils::{extract_range_or_offset, Fixture, RangeOrOffset, CURSOR_MARKER}; | 64 | use test_utils::{ |
65 | extract_range_or_offset, Fixture, RangeOrOffset, CURSOR_MARKER, ESCAPED_CURSOR_MARKER, | ||
66 | }; | ||
65 | use vfs::{file_set::FileSet, VfsPath}; | 67 | use vfs::{file_set::FileSet, VfsPath}; |
66 | 68 | ||
67 | use crate::{ | 69 | use crate::{ |
@@ -142,10 +144,14 @@ impl ChangeFixture { | |||
142 | 144 | ||
143 | for entry in fixture { | 145 | for entry in fixture { |
144 | let text = if entry.text.contains(CURSOR_MARKER) { | 146 | let text = if entry.text.contains(CURSOR_MARKER) { |
145 | let (range_or_offset, text) = extract_range_or_offset(&entry.text); | 147 | if entry.text.contains(ESCAPED_CURSOR_MARKER) { |
146 | assert!(file_position.is_none()); | 148 | entry.text.replace(ESCAPED_CURSOR_MARKER, CURSOR_MARKER) |
147 | file_position = Some((file_id, range_or_offset)); | 149 | } else { |
148 | text.to_string() | 150 | let (range_or_offset, text) = extract_range_or_offset(&entry.text); |
151 | assert!(file_position.is_none()); | ||
152 | file_position = Some((file_id, range_or_offset)); | ||
153 | text.to_string() | ||
154 | } | ||
149 | } else { | 155 | } else { |
150 | entry.text.clone() | 156 | entry.text.clone() |
151 | }; | 157 | }; |