diff options
author | darksv <[email protected]> | 2018-09-15 12:35:55 +0100 |
---|---|---|
committer | darksv <[email protected]> | 2018-09-15 12:35:55 +0100 |
commit | a29211918b728fb83246bfcb43d2ad9c79e182fb (patch) | |
tree | cff6617f8d54570058a8aa45a98a039424f7b4ea /crates/libsyntax2/src/text_utils.rs | |
parent | bc94bf95ce858ef247ebee006d50cfdc33f6bf5f (diff) |
create separated mod for reparsing functionality
Diffstat (limited to 'crates/libsyntax2/src/text_utils.rs')
-rw-r--r-- | crates/libsyntax2/src/text_utils.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/libsyntax2/src/text_utils.rs b/crates/libsyntax2/src/text_utils.rs index e3d73888f..58ae1e43e 100644 --- a/crates/libsyntax2/src/text_utils.rs +++ b/crates/libsyntax2/src/text_utils.rs | |||
@@ -17,3 +17,10 @@ pub fn intersect(r1: TextRange, r2: TextRange) -> Option<TextRange> { | |||
17 | None | 17 | None |
18 | } | 18 | } |
19 | } | 19 | } |
20 | |||
21 | pub fn replace_range(mut text: String, range: TextRange, replace_with: &str) -> String { | ||
22 | let start = u32::from(range.start()) as usize; | ||
23 | let end = u32::from(range.end()) as usize; | ||
24 | text.replace_range(start..end, replace_with); | ||
25 | text | ||
26 | } \ No newline at end of file | ||