summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-01-23 16:01:15 +0100
committerLaurenz <laurmaedje@gmail.com>2023-01-27 11:38:04 +0100
commit33585d9a3fbab8a76d3fd8e9c2560f929202a518 (patch)
tree30ca6e09c91539013dd9acc5684edc330d0c29ce
parent4653ffebb43d733a3cff873d0903c7d00aaeb499 (diff)
Small fixes
-rw-r--r--Cargo.lock1
-rw-r--r--Cargo.toml1
-rw-r--r--library/src/math/matrix.rs2
-rw-r--r--library/src/math/mod.rs1
-rw-r--r--library/src/math/root.rs2
-rw-r--r--src/ide/highlight.rs7
-rw-r--r--src/syntax/lexer.rs1
7 files changed, 13 insertions, 2 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 0234d4b4..69b01b2f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1094,6 +1094,7 @@ dependencies = [
"flate2",
"if_chain",
"image",
+ "log",
"miniz_oxide 0.5.4",
"once_cell",
"pdf-writer",
diff --git a/Cargo.toml b/Cargo.toml
index c18aa3b6..ac16e1ba 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,6 +19,7 @@ comemo = { git = "https://github.com/typst/comemo" }
flate2 = "1"
if_chain = "1"
image = { version = "0.24", default-features = false, features = ["png", "jpeg", "gif"] }
+log = "0.4"
miniz_oxide = "0.5"
once_cell = "1"
pdf-writer = "0.6"
diff --git a/library/src/math/matrix.rs b/library/src/math/matrix.rs
index 9472e989..27e1b282 100644
--- a/library/src/math/matrix.rs
+++ b/library/src/math/matrix.rs
@@ -31,7 +31,7 @@ impl VecNode {
///
/// # Example
/// ```
- /// #set vec(delim: "[")
+ /// #set math.vec(delim: "[")
/// $ vec(1, 2) $
/// ```
pub const DELIM: Delimiter = Delimiter::Paren;
diff --git a/library/src/math/mod.rs b/library/src/math/mod.rs
index 0de440be..45e33daf 100644
--- a/library/src/math/mod.rs
+++ b/library/src/math/mod.rs
@@ -56,6 +56,7 @@ pub fn module() -> Module {
math.def_func::<FloorFunc>("floor");
math.def_func::<CeilFunc>("ceil");
math.def_func::<AbsFunc>("abs");
+ math.def_func::<NormFunc>("norm");
math.def_func::<AccentNode>("accent");
math.def_func::<FracNode>("frac");
math.def_func::<BinomNode>("binom");
diff --git a/library/src/math/root.rs b/library/src/math/root.rs
index 2efe4e07..10573066 100644
--- a/library/src/math/root.rs
+++ b/library/src/math/root.rs
@@ -37,7 +37,7 @@ impl LayoutMath for SqrtNode {
///
/// ## Example
/// ```
-/// $ radical(3, x) $
+/// $ root(3, x) $
/// ```
///
/// ## Parameters
diff --git a/src/ide/highlight.rs b/src/ide/highlight.rs
index 5f615d04..75201d93 100644
--- a/src/ide/highlight.rs
+++ b/src/ide/highlight.rs
@@ -192,6 +192,13 @@ pub fn highlight(node: &LinkedNode) -> Option<Category> {
) => Some(Category::Interpolated),
Some(SyntaxKind::FuncCall) => Some(Category::Function),
Some(SyntaxKind::FieldAccess)
+ if node.parent().and_then(|p| p.parent_kind())
+ == Some(SyntaxKind::SetRule)
+ && node.next_sibling().is_none() =>
+ {
+ Some(Category::Function)
+ }
+ Some(SyntaxKind::FieldAccess)
if node
.parent()
.and_then(|p| p.parent())
diff --git a/src/syntax/lexer.rs b/src/syntax/lexer.rs
index 433d0def..1064939d 100644
--- a/src/syntax/lexer.rs
+++ b/src/syntax/lexer.rs
@@ -429,6 +429,7 @@ impl Lexer<'_> {
'-' if self.s.eat_if('>') => SyntaxKind::Shorthand,
'=' if self.s.eat_if('>') => SyntaxKind::Shorthand,
':' if self.s.eat_if('=') => SyntaxKind::Shorthand,
+ '.' if self.s.eat_if("..") => SyntaxKind::Shorthand,
'_' => SyntaxKind::Underscore,
'$' => SyntaxKind::Dollar,