summaryrefslogtreecommitdiff
path: root/crates/typst-syntax/src/source.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-10-27 19:04:55 +0100
committerGitHub <noreply@github.com>2024-10-27 18:04:55 +0000
commitbe7cfc85d08c545abfac08098b7b33b4bd71f37e (patch)
treef4137fa2aaa57babae1f7603a9b2ed7e688f43d8 /crates/typst-syntax/src/source.rs
parentb8034a343831e8609aec2ec81eb7eeda57aa5d81 (diff)
Split out four new crates (#5302)
Diffstat (limited to 'crates/typst-syntax/src/source.rs')
-rw-r--r--crates/typst-syntax/src/source.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/crates/typst-syntax/src/source.rs b/crates/typst-syntax/src/source.rs
index a2ccb5bb..3454a265 100644
--- a/crates/typst-syntax/src/source.rs
+++ b/crates/typst-syntax/src/source.rs
@@ -32,6 +32,7 @@ struct Repr {
impl Source {
/// Create a new source file.
pub fn new(id: FileId, text: String) -> Self {
+ let _scope = typst_timing::TimingScope::new("create source");
let mut root = parse(&text);
root.numberize(id, Span::FULL).unwrap();
Self(Arc::new(Repr {
@@ -75,6 +76,7 @@ impl Source {
///
/// Returns the range in the new source that was ultimately reparsed.
pub fn replace(&mut self, new: &str) -> Range<usize> {
+ let _scope = typst_timing::TimingScope::new("replace source");
let old = self.text();
let mut prefix =