Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

fix(#230): improve feature interconnectedness in other project crates

Grant Lemons637398879e0f
diff --git a/harper-cli/src/main.rs b/harper-cli/src/main.rs
index b8f4ab9c3..56fbeca60 100644
--- a/harper-cli/src/main.rs
+++ b/harper-cli/src/main.rs
@@ -10,9 +10,6 @@ use harper_core::linting::{LintGroup, LintGroupConfig, Linter};
use harper_core::parsers::Markdown;
use harper_core::{remove_overlaps, Dictionary, Document, FstDictionary};
-#[cfg(feature = "typst")]
-use harper_core::parsers::Typst;
-
#[derive(Debug, Parser)]
enum Args {
/// Lint a provided document.
@@ -148,7 +145,8 @@ fn load_file(file: &Path) -> anyhow::Result<(Document, String)> {
let parser: Box<dyn harper_core::parsers::Parser> =
match file.extension().map(|v| v.to_str().unwrap()) {
Some("md") => Box::new(Markdown),
- Some("typ") => Box::new(Typst),
+ #[cfg(feature = "typst")]
+ Some("typ") => Box::new(harper_core::parsers::Typst),
_ => Box::new(
CommentParser::new_from_filename(file)
.map(Box::new)
diff --git a/harper-comments/Cargo.toml b/harper-comments/Cargo.toml
index 15539bfa1..6b393c1d5 100644
--- a/harper-comments/Cargo.toml
+++ b/harper-comments/Cargo.toml
@@ -32,3 +32,6 @@ tree-sitter-haskell = "0.15.0"
[dev-dependencies]
paste = "1.0.15"
+
+[features]
+typst = ["harper-core/typst"]
diff --git a/harper-core/Cargo.toml b/harper-core/Cargo.toml
index d0db54669..0442c18c5 100644
--- a/harper-core/Cargo.toml
+++ b/harper-core/Cargo.toml
@@ -35,6 +35,5 @@ name = "parse_demo"
harness = false
[features]
-default = ["typst"]
-concurrent = []
typst = ["typst-syntax"]
+concurrent = []
diff --git a/harper-html/Cargo.toml b/harper-html/Cargo.toml
index bcfa535ec..5be988b2f 100644
--- a/harper-html/Cargo.toml
+++ b/harper-html/Cargo.toml
@@ -14,3 +14,6 @@ tree-sitter = "0.20.10"
[dev-dependencies]
paste = "1.0.15"
+
+[features]
+typst = ["harper-core/typst"]
diff --git a/harper-ls/Cargo.toml b/harper-ls/Cargo.toml
index 1bf9f91fd..419b40180 100644
--- a/harper-ls/Cargo.toml
+++ b/harper-ls/Cargo.toml
@@ -25,3 +25,7 @@ resolve-path = "0.1.0"
open = "5.3.0"
futures = "0.3.31"
serde = { version = "1.0.214", features = ["derive"] }
+
+[features]
+default = ["typst"]
+typst = ["harper-core/typst"]
diff --git a/harper-tree-sitter/Cargo.toml b/harper-tree-sitter/Cargo.toml
index 530f4ba49..9540cdabe 100644
--- a/harper-tree-sitter/Cargo.toml
+++ b/harper-tree-sitter/Cargo.toml
@@ -9,3 +9,7 @@ repository = "https://github.com/automattic/harper"
[dependencies]
harper-core = { path = "../harper-core", version = "0.14.0" }
tree-sitter = "0.20.10"
+
+[features]
+default = ["typst"]
+typst = ["harper-core/typst"]
diff --git a/harper-wasm/Cargo.toml b/harper-wasm/Cargo.toml
index 2ea1d21f6..3b918038d 100644
--- a/harper-wasm/Cargo.toml
+++ b/harper-wasm/Cargo.toml
@@ -14,7 +14,7 @@ console_error_panic_hook = "0.1.7"
tracing = "0.1.41"
tracing-wasm = "0.2.1"
wasm-bindgen = "0.2.97"
-harper-core = { path = "../harper-core", version = "0.14.0", features = ["concurrent"], default-features = false }
+harper-core = { path = "../harper-core", version = "0.14.0", features = ["concurrent"] }
once_cell = "1.20.2"
serde-wasm-bindgen = "0.6.5"
serde_json = "1.0.133"