Support more syntaxes for highlighting with two-face

Co-authored-by: Redhawk18 <redhawk76767676@gmail.com>
This commit is contained in:
Héctor Ramón Jiménez 2025-12-03 19:29:31 +01:00
parent aa8c0c3f4c
commit f78fcebe30
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
4 changed files with 16 additions and 4 deletions

13
Cargo.lock generated
View file

@ -2455,7 +2455,7 @@ name = "iced_highlighter"
version = "0.14.0-dev"
dependencies = [
"iced_core",
"syntect",
"two-face",
]
[[package]]
@ -6216,6 +6216,17 @@ dependencies = [
"utf-8",
]
[[package]]
name = "two-face"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d112cfd41c1387546416bcf49c4ae2a1fcacda0d42c9e97120e9798c90c0923"
dependencies = [
"serde",
"serde_derive",
"syntect",
]
[[package]]
name = "typenum"
version = "1.19.0"

View file

@ -221,12 +221,12 @@ sipper = "0.1"
smol = "2"
smol_str = "0.2"
softbuffer = { version = "0.4", default-features = false }
syntect = { version = "5", default-features = false, features = ["default-fancy"] }
sysinfo = "0.33"
thiserror = "2"
tiny-skia = { version = "0.11", default-features = false, features = ["std", "simd"] }
tokio = "1.0"
tracing = "0.1"
two-face = { version = "0.4", default-features = false, features = ["syntect-default-fancy"] }
unicode-segmentation = "1.0"
url = "2.5"
wasm-bindgen-futures = "0.4"

View file

@ -16,4 +16,4 @@ workspace = true
[dependencies]
iced_core.workspace = true
syntect.workspace = true
two-face.workspace = true

View file

@ -10,9 +10,10 @@ use std::sync::LazyLock;
use syntect::highlighting;
use syntect::parsing;
use two_face::re_exports::syntect;
static SYNTAXES: LazyLock<parsing::SyntaxSet> =
LazyLock::new(parsing::SyntaxSet::load_defaults_nonewlines);
LazyLock::new(two_face::syntax::extra_no_newlines);
static THEMES: LazyLock<highlighting::ThemeSet> =
LazyLock::new(highlighting::ThemeSet::load_defaults);