mirror of
https://github.com/sharkdp/bat.git
synced 2025-10-11 22:33:56 +01:00
Merge pull request #3413 from sharkdp/ansi_theme_json
Update ansi theme to highlight JSON keys separately from string values
This commit is contained in:
@@ -69,6 +69,7 @@
|
||||
- Updated Catppuccin, see #3333 (@SchweGELBin)
|
||||
- Updated gruvbox, see #3372 (@Nicholas42)
|
||||
- Updated GitHub theme, see #3382 (@CosmicHorrorDev)
|
||||
- Updated ANSI theme to highlight JSON object keys differently from values, see #3413 (@keith-hall)
|
||||
|
||||
## `bat` as a library
|
||||
|
||||
|
BIN
assets/themes.bin
vendored
BIN
assets/themes.bin
vendored
Binary file not shown.
2
assets/themes/ansi.tmTheme
vendored
2
assets/themes/ansi.tmTheme
vendored
@@ -234,7 +234,7 @@
|
||||
<key>name</key>
|
||||
<string>Headings</string>
|
||||
<key>scope</key>
|
||||
<string>markup.heading punctuation.definition.heading, entity.name.section, markup.heading - text.html.markdown</string>
|
||||
<string>markup.heading punctuation.definition.heading, entity.name.section, markup.heading - text.html.markdown, meta.mapping.key string.quoted.double</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
|
@@ -2404,6 +2404,24 @@ fn ansi_highlight_underline() {
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
// we don't really test other color schemes in the syntax-tests/source vs highlighted stuff
|
||||
// so here a simple integration test has been made for the ANSI theme,
|
||||
// which lives directly inside the bat repository
|
||||
#[test]
|
||||
fn ansi_highlight_json_keys() {
|
||||
bat()
|
||||
.arg("--paging=never")
|
||||
.arg("--color=always")
|
||||
.arg("--decorations=never")
|
||||
.arg("--theme=ansi")
|
||||
.arg("--language=json")
|
||||
.write_stdin("{\"foo\": \"bar\", \"test\": [123, \"baz\"] }")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("{\x1B[34m\"\x1B[0m\x1B[34mfoo\x1B[0m\x1B[34m\"\x1B[0m: \x1B[32m\"\x1B[0m\x1B[32mbar\x1B[0m\x1B[32m\"\x1B[0m, \x1B[34m\"\x1B[0m\x1B[34mtest\x1B[0m\x1B[34m\"\x1B[0m: [\x1B[33m123\x1B[0m, \x1B[32m\"\x1B[0m\x1B[32mbaz\x1B[0m\x1B[32m\"\x1B[0m] }")
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
// Ensure that ANSI passthrough is emitted properly for both wrapping and non-wrapping printer.
|
||||
// See https://github.com/sharkdp/bat/issues/2307 for what common use case this test tests.
|
||||
#[test]
|
||||
|
Reference in New Issue
Block a user