Skip to content

Commit

Permalink
refactor: move typst parsing to a new crate
Browse files Browse the repository at this point in the history
  • Loading branch information
grantlemons committed Jan 4, 2025
1 parent 6dcf841 commit 1672de3
Show file tree
Hide file tree
Showing 18 changed files with 815 additions and 755 deletions.
14 changes: 13 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = [ "harper-cli", "harper-core", "harper-ls", "harper-comments", "harper-wasm", "harper-tree-sitter", "harper-html"]
members = [ "harper-cli", "harper-core", "harper-ls", "harper-comments", "harper-wasm", "harper-tree-sitter", "harper-html", "harper-typst"]
resolver = "2"

[profile.release]
Expand Down
3 changes: 2 additions & 1 deletion harper-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ ariadne = "0.4.1"
clap = { version = "4.5.23", features = ["derive"] }
harper-core = { path = "../harper-core", version = "0.14.0" }
harper-comments = { path = "../harper-comments", version = "0.14.0" }
harper-typst = { path = "../harper-typst", version = "0.14.0", optional = true }
serde_json = "1.0.133"

[features]
default = ["typst"]
typst = ["harper-core/typst"]
typst = ["dep:harper-typst"]
2 changes: 1 addition & 1 deletion harper-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ fn load_file(file: &Path) -> anyhow::Result<(Document, String)> {
match file.extension().map(|v| v.to_str().unwrap()) {
Some("md") => Box::new(Markdown),
#[cfg(feature = "typst")]
Some("typ") => Box::new(harper_core::parsers::Typst),
Some("typ") => Box::new(harper_typst::Typst),
_ => Box::new(
CommentParser::new_from_filename(file)
.map(Box::new)
Expand Down
3 changes: 0 additions & 3 deletions harper-comments/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,3 @@ tree-sitter-haskell = "0.15.0"

[dev-dependencies]
paste = "1.0.15"

[features]
typst = ["harper-core/typst"]
3 changes: 1 addition & 2 deletions harper-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ thiserror = "2.0.9"
unicode-blocks = "0.1.9"
unicode-width = "0.2.0"
levenshtein_automata = { version = "0.2.1", features = ["fst_automaton"] }
typst-syntax = { version = "0.12.0", optional = true }

[dev-dependencies]
criterion = { version = "0.5.1", default-features = false }
Expand All @@ -35,5 +34,5 @@ name = "parse_demo"
harness = false

[features]
typst = ["dep:typst-syntax"]
default = []
concurrent = []
5 changes: 0 additions & 5 deletions harper-core/src/parsers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ mod markdown;
mod mask;
mod plain_english;

#[cfg(feature = "typst")]
mod typst;
#[cfg(feature = "typst")]
pub use typst::Typst;

use blanket::blanket;
pub use collapse_identifiers::CollapseIdentifiers;
pub use isolate_english::IsolateEnglish;
Expand Down
Loading

0 comments on commit 1672de3

Please sign in to comment.