Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

Commit 0a46577

Browse files
committed
update to typst v0.10.0
1 parent 8427250 commit 0a46577

File tree

20 files changed

+480
-556
lines changed

20 files changed

+480
-556
lines changed

Cargo.lock

Lines changed: 436 additions & 521 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ native-tls = ["reqwest?/native-tls"]
2727
fontconfig = ["fontdb/fontconfig"]
2828

2929
[dependencies]
30-
typst = { git = "https://github.com/typst/typst.git", tag = "v0.9.0" }
31-
typst-library = { git = "https://github.com/typst/typst.git", tag = "v0.9.0" }
32-
typst-ide = { git = "https://github.com/typst/typst.git", tag = "v0.9.0" }
30+
typst = { git = "https://github.com/typst/typst.git", tag = "v0.10.0" }
31+
typst-ide = { git = "https://github.com/typst/typst.git", tag = "v0.10.0" }
32+
typst-pdf = { git = "https://github.com/typst/typst.git", tag = "v0.10.0" }
3333

3434
anyhow = "1.0.71"
3535
async-compression = { version = "0.4.1", features = ["tokio", "gzip"] }
@@ -42,7 +42,11 @@ chrono = { version = "0.4.24", default-features = false, features = [
4242
comemo = "0.3"
4343
dirs = "5.0"
4444
elsa = "1.9.0"
45-
fontdb = { version = "0.16.0", default-features = false, features = ["std", "fs", "memmap"] }
45+
fontdb = { version = "0.16.0", default-features = false, features = [
46+
"std",
47+
"fs",
48+
"memmap",
49+
] }
4650
futures = "0.3"
4751
if_chain = "1.0"
4852
indexmap = "2.1.0"

src/lsp_typst_boundary.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub type TypstRange = std::ops::Range<usize>;
2121
pub type TypstTooltip = typst_ide::Tooltip;
2222
pub type LspHoverContents = lsp_types::HoverContents;
2323

24-
pub type TypstDatetime = typst::eval::Datetime;
24+
pub type TypstDatetime = typst::foundations::Datetime;
2525

2626
pub type LspDiagnostic = lsp_types::Diagnostic;
2727
pub type TypstDiagnostic = typst::diag::SourceDiagnostic;
@@ -30,7 +30,7 @@ pub type LspSeverity = lsp_types::DiagnosticSeverity;
3030
pub type TypstSeverity = typst::diag::Severity;
3131

3232
pub type LspParamInfo = lsp_types::ParameterInformation;
33-
pub type TypstParamInfo = typst::eval::ParamInfo;
33+
pub type TypstParamInfo = typst::foundations::ParamInfo;
3434

3535
/// An LSP range with its associated encoding.
3636
pub struct LspRange {
@@ -130,10 +130,9 @@ pub mod typst_to_lsp {
130130
LanguageString, Location, MarkedString, MarkupContent, MarkupKind, TextEdit,
131131
};
132132
use tracing::error;
133-
use typst::diag::Tracepoint;
134-
use typst::eval::{CastInfo, Repr};
133+
use typst::diag::{EcoString, Tracepoint};
134+
use typst::foundations::{CastInfo, Repr};
135135
use typst::syntax::{FileId, Source, Spanned};
136-
use typst_library::prelude::EcoString;
137136

138137
use crate::config::ConstConfig;
139138
use crate::server::diagnostics::DiagnosticsMap;

src/server/export.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::sync::Arc;
33
use anyhow::Context;
44
use tower_lsp::lsp_types::Url;
55
use tracing::info;
6-
use typst::doc::Document;
6+
use typst::model::Document;
77

88
use crate::ext::UrlExt;
99

@@ -22,7 +22,7 @@ impl TypstServer {
2222
self.thread_with_world(source_uri)
2323
.await?
2424
.run(move |world| {
25-
let data = typst::export::pdf(&document, Some(pdf_uri.as_str()), world.now());
25+
let data = typst_pdf::pdf(&document, Some(pdf_uri.as_str()), world.now());
2626

2727
world
2828
.write_raw(&pdf_uri, &data)

src/server/hover.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ impl TypstServer {
1515
) -> anyhow::Result<Option<Hover>> {
1616
let position_encoding = self.const_config().position_encoding;
1717

18+
let doc = self.document.lock().await.clone();
19+
1820
let result = self
1921
.thread_with_world(uri)
2022
.await?
@@ -24,7 +26,7 @@ impl TypstServer {
2426
let typst_offset =
2527
lsp_to_typst::position_to_offset(position, position_encoding, &source);
2628

27-
let typst_tooltip = typst_ide::tooltip(&world, &[], &source, typst_offset)?;
29+
let typst_tooltip = typst_ide::tooltip(&world, Some(&doc), &source, typst_offset)?;
2830

2931
Some((typst_offset, typst_tooltip))
3032
})

src/server/lsp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ impl LanguageServer for TypstServer {
400400
let typst_offset =
401401
lsp_to_typst::position_to_offset(position, position_encoding, &source);
402402
let (typst_start_offset, completions) =
403-
typst_ide::autocomplete(&world, &doc.pages, &source, typst_offset, explicit)?;
403+
typst_ide::autocomplete(&world, Some(&doc), &source, typst_offset, explicit)?;
404404
let lsp_start_position =
405405
offset_to_position(typst_start_offset, position_encoding, &source);
406406

src/server/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use tokio::sync::{Mutex, OwnedRwLockReadGuard, RwLock, RwLockReadGuard};
66
use tower_lsp::lsp_types::Url;
77
use tower_lsp::Client;
88
use tracing_subscriber::{reload, Registry};
9-
use typst::doc::Document;
9+
use typst::model::Document;
1010
use typst::syntax::Source;
1111

1212
use crate::config::{Config, ConstConfig};
@@ -78,8 +78,8 @@ impl TypstServer {
7878
.expect("workspace should be initialized")
7979
}
8080

81-
pub fn typst_global_scopes(&self) -> typst::eval::Scopes {
82-
typst::eval::Scopes::new(Some(&TYPST_STDLIB))
81+
pub fn typst_global_scopes(&self) -> typst::foundations::Scopes {
82+
typst::foundations::Scopes::new(Some(&TYPST_STDLIB))
8383
}
8484

8585
#[tracing::instrument(skip(self))]

src/server/semantic_tokens/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use tower_lsp::lsp_types::{
44
Registration, SemanticToken, SemanticTokensEdit, SemanticTokensFullOptions,
55
SemanticTokensLegend, SemanticTokensOptions, Unregistration,
66
};
7+
use typst::diag::EcoString;
78
use typst::syntax::{ast, LinkedNode, Source, SyntaxKind};
8-
use typst_library::prelude::EcoString;
99

1010
use self::delta::token_delta;
1111
use self::modifier_set::ModifierSet;

src/server/semantic_tokens/token_encode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use tower_lsp::lsp_types::{Position, SemanticToken};
2+
use typst::diag::EcoString;
23
use typst::syntax::Source;
3-
use typst_library::prelude::EcoString;
44

55
use crate::config::PositionEncoding;
66
use crate::ext::{PositionExt, StrExt};

src/server/signature.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use tower_lsp::lsp_types::{
44
SignatureInformation, Url,
55
};
66
use tracing::trace;
7-
use typst::eval::{Func, ParamInfo, Scopes, Value};
7+
use typst::foundations::{Func, ParamInfo, Scopes, Value};
88
use typst::syntax::{ast, LinkedNode, Source, SyntaxKind};
99

1010
use crate::lsp_typst_boundary::{lsp_to_typst, typst_to_lsp, LspPosition, TypstOffset};

src/server/typst_compiler.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ use std::sync::Arc;
22

33
use comemo::Track;
44
use tower_lsp::lsp_types::Url;
5-
use typst::doc::Document;
6-
use typst::eval::{Module, Route, Tracer};
5+
use typst::engine::Route;
6+
use typst::eval::Tracer;
7+
use typst::foundations::Module;
8+
use typst::model::Document;
79
use typst::World;
810

911
use crate::lsp_typst_boundary::typst_to_lsp;

src/workspace/font_manager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use comemo::Prehashed;
77
use fontdb::{Database, Source};
88
use once_cell::sync::OnceCell;
99
use tracing::error;
10-
use typst::eval::Bytes;
11-
use typst::font::{Font, FontBook, FontInfo};
10+
use typst::foundations::Bytes;
11+
use typst::text::{Font, FontBook, FontInfo};
1212

1313
use super::fs::local::LocalFs;
1414
use super::fs::FsError;

src/workspace/fs/cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use elsa::sync::FrozenMap;
55
use once_cell::sync::OnceCell;
66
use tower_lsp::lsp_types::Url;
77
use tracing::trace;
8-
use typst::eval::Bytes;
8+
use typst::foundations::Bytes;
99
use typst::syntax::Source;
1010

1111
use crate::ext::PathExt;

src/workspace/fs/local.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::fs;
22
use std::path::{Path, PathBuf};
33

44
use tower_lsp::lsp_types::Url;
5-
use typst::eval::Bytes;
5+
use typst::foundations::Bytes;
66
use typst::syntax::Source;
77
use walkdir::WalkDir;
88

src/workspace/fs/lsp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::collections::{HashMap, HashSet};
22

33
use anyhow::anyhow;
44
use tower_lsp::lsp_types::{TextDocumentContentChangeEvent, Url};
5-
use typst::eval::Bytes;
5+
use typst::foundations::Bytes;
66
use typst::syntax::Source;
77

88
use crate::config::PositionEncoding;

src/workspace/fs/manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::collections::HashSet;
22

33
use tower_lsp::lsp_types::{TextDocumentContentChangeEvent, Url};
4-
use typst::eval::Bytes;
4+
use typst::foundations::Bytes;
55
use typst::syntax::Source;
66

77
use crate::config::PositionEncoding;

src/workspace/fs/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};
55
use tower_lsp::lsp_types::Url;
66
use tracing::error;
77
use typst::diag::FileError;
8-
use typst::eval::Bytes;
8+
use typst::foundations::Bytes;
99
use typst::syntax::{FileId, Source};
1010

1111
use crate::ext::UriError;

src/workspace/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ use tower_lsp::lsp_types::{
4040
InitializeParams, TextDocumentContentChangeEvent, Url, WorkspaceFoldersChangeEvent,
4141
};
4242
use tracing::trace;
43-
use typst::eval::{Bytes, Library};
43+
use typst::foundations::Bytes;
4444
use typst::syntax::Source;
45+
use typst::Library;
4546

4647
use crate::config::PositionEncoding;
4748
use crate::ext::InitializeParamsExt;
@@ -60,7 +61,7 @@ pub mod project;
6061
pub mod world;
6162

6263
lazy_static! {
63-
pub static ref TYPST_STDLIB: Prehashed<Library> = Prehashed::new(typst_library::build());
64+
pub static ref TYPST_STDLIB: Prehashed<Library> = Prehashed::new(Library::default());
6465
}
6566

6667
#[derive(Debug)]

src/workspace/project.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ use std::sync::Arc;
44
use comemo::Prehashed;
55
use tokio::sync::OwnedRwLockReadGuard;
66
use tower_lsp::lsp_types::Url;
7-
use typst::eval::{Bytes, Library};
8-
use typst::font::{Font, FontBook};
7+
use typst::foundations::Bytes;
98
use typst::syntax::{FileId, Source};
9+
use typst::text::{Font, FontBook};
10+
use typst::Library;
1011

1112
use crate::ext::FileIdExt;
1213

src/workspace/world/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ use futures::Future;
33
use tokio::runtime;
44
use tower_lsp::lsp_types::Url;
55
use typst::diag::{EcoString, FileResult};
6-
use typst::eval::{Bytes, Datetime, Library};
7-
use typst::font::{Font, FontBook};
6+
use typst::foundations::{Bytes, Datetime};
87
use typst::syntax::{FileId, PackageSpec, Source};
9-
use typst::World;
8+
use typst::text::{Font, FontBook};
9+
use typst::{Library, World};
1010

1111
use crate::workspace::fs::{FsError, FsResult};
1212
use crate::workspace::project::Project;

0 commit comments

Comments
 (0)