summaryrefslogtreecommitdiff
path: root/src/source.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-02-09 17:45:04 +0100
committerLaurenz <laurmaedje@gmail.com>2022-02-09 18:15:39 +0100
commit642e149464341e3cf1856dda51d7f7a5b387081e (patch)
tree8f03a2e9811eb5a283eb9fed9d70931412e32086 /src/source.rs
parent5a0e7cc36107c03001696b6dfbfdeb47abd2aeac (diff)
Incremental bug fixes
Co-Authored-By: Martin Haug <mhaug@live.de>
Diffstat (limited to 'src/source.rs')
-rw-r--r--src/source.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/source.rs b/src/source.rs
index 0e7b4c63..2a134d9a 100644
--- a/src/source.rs
+++ b/src/source.rs
@@ -108,11 +108,17 @@ impl SourceStore {
/// Edit a source file by replacing the given range.
///
- /// This panics if no source file with this `id` exists or if the `replace`
- /// range is out of bounds for the source file identified by `id`.
+ /// Returns the range of the section in the new source that was ultimately
+ /// reparsed. This panics if no source file with this `id` exists or if the
+ /// `replace` range is out of bounds.
#[track_caller]
- pub fn edit(&mut self, id: SourceId, replace: Range<usize>, with: &str) {
- self.sources[id.0 as usize].edit(replace, with);
+ pub fn edit(
+ &mut self,
+ id: SourceId,
+ replace: Range<usize>,
+ with: &str,
+ ) -> Range<usize> {
+ self.sources[id.0 as usize].edit(replace, with)
}
}