From 27ba45ded7c24266c1d1b2547c2539516c5604c9 Mon Sep 17 00:00:00 2001 From: Keith Hall Date: Sun, 9 Feb 2025 12:56:53 +0200 Subject: [PATCH] patch Monokai Extended theme for better Syslog error highlighting --- CHANGELOG.md | 1 + assets/patches/Monokai-Extended.tmTheme.patch | 19 +++++++++-- doc/assets.md | 2 +- .../syntax-tests/highlighted/Log/example.log | 2 +- .../highlighted/Syslog/example.syslog | 33 ++++++++++--------- 5 files changed, 37 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61103651..71c8b749 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - Add syntax mapping for `paru` configuration files #3182 (@cyqsimon) - Add support for [Idris 2 programming language](https://www.idris-lang.org/) #3150 (@buzden) - Add syntax mapping for `nix`'s '`flake.lock` lockfiles #3196 (@odilf) +- Improve (Sys)log error highlighting, see #3205 (@keith-hall) ## Themes diff --git a/assets/patches/Monokai-Extended.tmTheme.patch b/assets/patches/Monokai-Extended.tmTheme.patch index 106b584d..ece5d49c 100644 --- a/assets/patches/Monokai-Extended.tmTheme.patch +++ b/assets/patches/Monokai-Extended.tmTheme.patch @@ -21,11 +21,26 @@ index 9c2aa3e..180cbbf 100644 Invalid scope - invalid -+ invalid, markup.error ++ invalid, meta.annotation.error-line settings background -@@ -1042,7 +1042,7 @@ +@@ -1038,11 +1038,22 @@ + #f8f8f0 + + ++ ++ name ++ Error ++ scope ++ markup.error ++ settings ++ ++ foreground ++ #dd2020 ++ ++ + name Invalid deprecated scope diff --git a/doc/assets.md b/doc/assets.md index a06a1e67..032a7883 100644 --- a/doc/assets.md +++ b/doc/assets.md @@ -26,7 +26,7 @@ in the `.sublime-syntax` format. 4. Re-compile `bat`. At compilation time, the `syntaxes.bin` file will be stored inside the `bat` binary. -5. Use `bat --list-languages` to check if the new languages are available. +5. Use `bat --list-languages` to check if the new languages are available. You may want to do something like `export PATH="`pwd`/target/debug:$PATH"` to ensure the locally compiled version is the one being used. 6. Add a syntax test for the new language. See [below](#Syntax-tests) for details. diff --git a/tests/syntax-tests/highlighted/Log/example.log b/tests/syntax-tests/highlighted/Log/example.log index f0e9754a..57e0e9a3 100644 --- a/tests/syntax-tests/highlighted/Log/example.log +++ b/tests/syntax-tests/highlighted/Log/example.log @@ -1,3 +1,3 @@ 2021-03-06 23:22:21.392 https://[2001:db8:4006:812::200e]:8080/path/the%20page.html 2021-03-06 23:22:21 https://example.com:8080/path/the%20page(with_parens).html -2022-03-16T17:41:02.519 helix_term::application [WARN] unhandled window/showMessage: ShowMessageParams { typ: Error, message: "rust-analyzer failed to load workspace: Failed to read Cargo metadata from Cargo.toml file /home/zeta/dev/raytracer/Cargo.toml, cargo 1.61.0-nightly (65c8266 2022-03-09): Failed to run `\"cargo\" \"metadata\" \"--format-version\" \"1\" \"--manifest-path\" \"/home/zeta/dev/raytracer/Cargo.toml\" \"--filter-platform\" \"wasm32-unknown-unknown\"`: `cargo metadata` exited with an error: Updating crates.io index\nerror: failed to select a version for `parking_lot`.\n ... required by package `raytracer v0.1.0 (/home/zeta/dev/raytracer)`\nversions that meet the requirements `^0.12.0` are: 0.12.0\n\nthe package `raytracer` depends on `parking_lot`, with features: `wasm-bindgen` but `parking_lot` does not have these features.\n\n\nfailed to select a version for `parking_lot` which could resolve this conflict\n" } +2022-03-16T17:41:02.519 helix_term::application [WARN] unhandled window/showMessage: ShowMessageParams { typ: Error, message: "rust-analyzer failed to load workspace: Failed to read Cargo metadata from Cargo.toml file /home/zeta/dev/raytracer/Cargo.toml, cargo 1.61.0-nightly (65c8266 2022-03-09): Failed to run `\"cargo\" \"metadata\" \"--format-version\" \"1\" \"--manifest-path\" \"/home/zeta/dev/raytracer/Cargo.toml\" \"--filter-platform\" \"wasm32-unknown-unknown\"`: `cargo metadata` exited with an error: Updating crates.io index\nerror: failed to select a version for `parking_lot`.\n ... required by package `raytracer v0.1.0 (/home/zeta/dev/raytracer)`\nversions that meet the requirements `^0.12.0` are: 0.12.0\n\nthe package `raytracer` depends on `parking_lot`, with features: `wasm-bindgen` but `parking_lot` does not have these features.\n\n\nfailed to select a version for `parking_lot` which could resolve this conflict\n" } diff --git a/tests/syntax-tests/highlighted/Syslog/example.syslog b/tests/syntax-tests/highlighted/Syslog/example.syslog index 0c200c33..78c45a12 100644 --- a/tests/syntax-tests/highlighted/Syslog/example.syslog +++ b/tests/syntax-tests/highlighted/Syslog/example.syslog @@ -1,16 +1,17 @@ -Apr 4 00:00:01 hostname-here systemd[1]: logrotate.service: Succeeded. -Apr 4 00:00:01 hostname-here systemd[1]: Finished Rotate log files. -Apr 4 00:00:01 hostname-here colord[920]: failed to get session [pid 137485]: No data available -Apr 4 00:00:21 hostname-here kernel: [55604.908232] audit: type=1400 audit(1617483621.094:28): apparmor="DENIED" operation="capable" profile="/usr/sbin/cups-browsed" pid=59311 comm="cups-browsed" capability=23 capname="sys_nice" -Apr 4 00:01:38 hostname-here systemd-resolved[721]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP. -Apr 4 00:04:46 hostname-here ntpd[952]: Soliciting pool server 255.76.59.37 -Apr 4 00:05:21 hostname-here ntpd[952]: ::1 local addr 0:0:0:0:0:0:0:1 ->  -Apr 4 00:06:29 hostname-here ntpd[952]: receive: Unexpected origin timestamp 0xe414a8d1.82e825f5 does not match aorg 0xe414a8d5.82c50d8c from server@127.0.0.1 xmt 0xe414a8d1.e671d7c4 -Apr 4 09:30:01 hostname-here CRON[89278]: (root) CMD ([ -x /etc/init.d/anacron ] && if [ ! -d /run/systemd/system ]; then /usr/sbin/invoke-rc.d anacron start >/dev/null; fi) -Apr 4 16:32:07 hostname-here NetworkManager[740]:  [1617629527.1101] manager: NetworkManager state is now CONNECTED_GLOBAL -Apr 4 22:00:45 hostname-here dbus-daemon[1094]: [session uid=1000 pid=1094] Successfully activated service 'io.github.celluloid_player.Celluloid' -Aug 11 13:29:06 hostname-here insomnia_insomnia.desktop[142666]: 13:29:06.316 › [updater] Updater not running platform=linux dev=false -Aug 11 13:36:34 192.168.220.5 nginx: 2021/08/11 13:36:34 [debug] 2031#2031: epoll add event: fd:6 op:1 ev:00002001 -Aug 11 21:31:08 ::1 nginx: 2021/08/11 21:31:08 [debug] 760831#760831: epoll add event: fd:6 op:1 ev:10000001 -Aug 11 21:40:31 hostname-here scop hello -Aug 16 21:38:21 hostname-here systemd[1]: Finished Cleanup of Temporary Directories. +Apr 4 00:00:01 hostname-here systemd[1]: logrotate.service: Succeeded. +Apr 4 00:00:01 hostname-here systemd[1]: Finished Rotate log files. +Apr 4 00:00:01 hostname-here colord[920]: failed to get session [pid 137485]: No data available +Apr 4 00:00:21 hostname-here kernel: [55604.908232] audit: type=1400 audit(1617483621.094:28): apparmor="DENIED" operation="capable" profile="/usr/sbin/cups-browsed" pid=59311 comm="cups-browsed" capability=23 capname="sys_nice" +Apr 4 00:01:38 hostname-here systemd-resolved[721]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP. +Apr 4 00:04:46 hostname-here ntpd[952]: Soliciting pool server 255.76.59.37 +Apr 4 00:05:21 hostname-here ntpd[952]: ::1 local addr 0:0:0:0:0:0:0:1 ->  +Apr 4 00:06:29 hostname-here ntpd[952]: receive: Unexpected origin timestamp 0xe414a8d1.82e825f5 does not match aorg 0xe414a8d5.82c50d8c from server@127.0.0.1 xmt 0xe414a8d1.e671d7c4 +Apr 4 09:30:01 hostname-here CRON[89278]: (root) CMD ([ -x /etc/init.d/anacron ] && if [ ! -d /run/systemd/system ]; then /usr/sbin/invoke-rc.d anacron start >/dev/null; fi) +Apr 4 16:32:07 hostname-here NetworkManager[740]:  [1617629527.1101] manager: NetworkManager state is now CONNECTED_GLOBAL +Apr 4 22:00:45 hostname-here dbus-daemon[1094]: [session uid=1000 pid=1094] Successfully activated service 'io.github.celluloid_player.Celluloid' +Aug 11 13:29:06 hostname-here insomnia_insomnia.desktop[142666]: 13:29:06.316 › [updater] Updater not running platform=linux dev=false +Aug 11 13:36:34 192.168.220.5 nginx: 2021/08/11 13:36:34 [debug] 2031#2031: epoll add event: fd:6 op:1 ev:00002001 +Aug 11 21:31:08 ::1 nginx: 2021/08/11 21:31:08 [debug] 760831#760831: epoll add event: fd:6 op:1 ev:10000001 +Aug 11 21:40:31 hostname-here scop hello +Aug 16 21:38:21 hostname-here systemd[1]: Finished Cleanup of Temporary Directories. +2025-02-08 20:52:11.039 - setfont: ERROR kdfontop.c:183 put_font_kdfontop: Unable to load such font with such kernel version