syntect additional file type support (#2160)

closes #2005

Co-authored-by: MHS <mhs@histolution.com>
This commit is contained in:
Martí Homs Soler 2024-03-27 14:57:37 +01:00 committed by GitHub
parent 5fafe784d1
commit 3b7b443e2a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 17 additions and 3 deletions

View file

@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixes
* bump yanked dependency `bumpalo` to fix build from source ([#2087](https://github.com/extrawurst/gitui/issues/2087))
* pin `ratatui` version to fix building without locked `cargo install gitui` ([#2090](https://github.com/extrawurst/gitui/issues/2090))
* add syntax highlighting support for more file types, e.g. Typescript, TOML, etc. [[@martihomssoler](https://github.com/martihomssoler)] ([#2005](https://github.com/extrawurst/gitui/issues/2005))
## [0.25.0] - 2024-02-21

12
Cargo.lock generated
View file

@ -759,6 +759,7 @@ dependencies = [
"syntect",
"tempfile",
"tui-textarea",
"two-face",
"unicode-segmentation",
"unicode-truncate",
"unicode-width",
@ -1747,6 +1748,17 @@ dependencies = [
"unicode-width",
]
[[package]]
name = "two-face"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37bed2135b2459c7eefba72c906d374697eb15949c205f2f124e3636a46b5eeb"
dependencies = [
"once_cell",
"serde",
"syntect",
]
[[package]]
name = "unicode-bidi"
version = "0.3.15"

View file

@ -55,6 +55,7 @@ syntect = { version = "5.2", default-features = false, features = [
"html",
] }
tui-textarea = "0.4.0"
two-face = { version = "0.3.0", default-features = false }
unicode-segmentation = "1.11"
unicode-truncate = "0.2"
unicode-width = "0.1"
@ -71,8 +72,8 @@ maintenance = { status = "actively-developed" }
default = ["ghemoji", "regex-fancy", "trace-libgit", "vendor-openssl"]
ghemoji = ["gh-emoji"]
# regex-* features are mutually exclusive.
regex-fancy = ["syntect/regex-fancy"]
regex-onig = ["syntect/regex-onig"]
regex-fancy = ["syntect/regex-fancy", "two-face/syntect-fancy"]
regex-onig = ["syntect/regex-onig", "two-face/syntect-onig"]
timing = ["scopetime/enabled"]
trace-libgit = ["asyncgit/trace-libgit"]
vendor-openssl = ["asyncgit/vendor-openssl"]

View file

@ -33,7 +33,7 @@ pub struct SyntaxText {
}
static SYNTAX_SET: Lazy<SyntaxSet> =
Lazy::new(SyntaxSet::load_defaults_nonewlines);
Lazy::new(two_face::syntax::extra_no_newlines);
static THEME_SET: Lazy<ThemeSet> = Lazy::new(ThemeSet::load_defaults);
pub struct AsyncProgressBuffer {