diff options
author | Martà Homs Soler <martihomssoler@gmail.com> | 2024-03-27 14:57:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-27 13:57:37 +0000 |
commit | 3b7b443e2a2cbf1f8b7d304d4ca4c294da02c272 (patch) | |
tree | becb66ec98c4428b48238af5370d8696c3c72694 | |
parent | 5fafe784d1265c6bb5fc5526256c6f7d3eb2c48a (diff) |
syntect additional file type support (#2160)
closes #2005
Co-authored-by: MHS <mhs@histolution.com>
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | Cargo.lock | 12 | ||||
-rw-r--r-- | Cargo.toml | 5 | ||||
-rw-r--r-- | src/ui/syntax_text.rs | 2 |
4 files changed, 17 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d8ba368..a0b17ee0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 @@ -759,6 +759,7 @@ dependencies = [ "syntect", "tempfile", "tui-textarea", + "two-face", "unicode-segmentation", "unicode-truncate", "unicode-width", @@ -1748,6 +1749,17 @@ dependencies = [ ] [[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" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -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"] diff --git a/src/ui/syntax_text.rs b/src/ui/syntax_text.rs index 776196ed..fba036e7 100644 --- a/src/ui/syntax_text.rs +++ b/src/ui/syntax_text.rs @@ -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 { |