Skip to content

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

feat(harper-typst): ignore .display as well

Donny Kim8c5760b952bc
diff --git a/harper-typst/src/typst_translator.rs b/harper-typst/src/typst_translator.rs
index 299f6e798..4e790782a 100644
--- a/harper-typst/src/typst_translator.rs
+++ b/harper-typst/src/typst_translator.rs
@@ -221,9 +221,10 @@ impl<'a> TypstTranslator<'a> {
)
};
+ let text = get_text!(func.callee());
merge![
token!(func.callee(), TokenKind::Unlintable),
- match get_text!(func.callee()) {
+ match text {
"std.rgb" | "color.rgb" | "rgb" => parse_args_without(true, &[]),
"std.plugin" | "plugin" => parse_args_without(true, &[]),
"std.bibliography" | "bibliography" => parse_args_without(true, &["style"]),
@@ -231,6 +232,7 @@ impl<'a> TypstTranslator<'a> {
"std.raw" | "raw" => parse_args_without(false, &["syntaxes", "theme"]),
"std.image" | "image" => parse_args_without(true, &[]),
"std.regex" | "regex" => parse_args_without(true, &[]),
+ _ if text.ends_with(".display") => parse_args_without(true, &[]),
_ => parse_args(&mut func.args().items()),
}
]
diff --git a/harper-typst/tests/run_tests.rs b/harper-typst/tests/run_tests.rs
index f741f382e..b89edd8a5 100644
--- a/harper-typst/tests/run_tests.rs
+++ b/harper-typst/tests/run_tests.rs
@@ -38,4 +38,4 @@ create_test!(complex_document.typ, 0);
create_test!(simplified_document.typ, 0);
create_test!(complex_document_with_spelling_mistakes.typ, 4);
// create_test!(issue_399.typ, 3);
-create_test!(function_with_ignorable_args.typ, 8);
+create_test!(function_with_ignorable_args.typ, 9);
diff --git a/harper-typst/tests/test_sources/function_with_ignorable_args.typ b/harper-typst/tests/test_sources/function_with_ignorable_args.typ
index 1e15772be..c97c21b2e 100644
--- a/harper-typst/tests/test_sources/function_with_ignorable_args.typ
+++ b/harper-typst/tests/test_sources/function_with_ignorable_args.typ
@@ -13,3 +13,5 @@
#std.raw(syntaxes: ("../a", "../b"), theme: "../c", [Errorz])
#std.image("../a", caption: [Errorz])
#std.regex("(?i)")
+#datetime.today().display("y:[year repr:last_two]")
+#context counter(heading).display("i", both: [Errorz])