Bat: JSON highlighting doesn't look right

Created on 6 Jul 2020  路  6Comments  路  Source: sharkdp/bat

What version of bat are you using?
bat 0.15.4

Describe the bug you encountered:
Bat does not seem to highlight JSON files very well. Specifically, there's almost no highlighting at all, even though the screenshots would indicate it knows how to highlight keys differently to values in maps.
image

Describe what you expected to happen?
Something that looks more like the picture on #48
image

How did you install bat?
homebrew


system

$ uname -srm
Darwin 18.7.0 x86_64

$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.14.6
BuildVersion: 18G5033

bat

$ bat --version
bat 0.15.4

$ env

bat_config

bat_wrapper

No wrapper script for 'bat'.

bat_wrapper_function

No wrapper function for 'bat'.

No wrapper function for 'cat'.

tool

$ less --version
less 487 (POSIX regular expressions)

syntax-highlighting upstream-error

Most helpful comment

Happy to help. You can count me in on the testing effort. I've been meaning to become more than barely-literate in Rust, and this seems like a good opportunity to expand.

All 6 comments

image

Yeah, that definitely doesn't look right. And it looks like it hasn't been highlighting JSON properly since the 0.13 release. Specifically, the changes in the Packages submodule pulled in with 7ba5bc78b742ba722246f49f20d9029964ddb032 seem to be the culprit.


As a side note, on a light terminal you might be better off using --theme OneHalfLight.

I normally use a dark terminal, these were taken with the vanilla MacOS terminal only to remove any possibility that something in my iterm config was the culprit. And even your 0.12.1 screenshot looks wrong: it's not highlighting anything under GlossDiv

Thank you for reporting this!

In order to prevent bugs like this in the future, I'd like to implement what I proposed here: https://github.com/sharkdp/bat/pull/988#issuecomment-627768181 We should probably open a new ticket for that.

Happy to help. You can count me in on the testing effort. I've been meaning to become more than barely-literate in Rust, and this seems like a good opportunity to expand.

That sounds great!

@flowchartsman I have opened #1124 to address this. Let's move the discussion to that ticket.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jkaan picture jkaan  路  3Comments

rien333 picture rien333  路  3Comments

tbsvttr picture tbsvttr  路  3Comments

niedzielski picture niedzielski  路  3Comments

adamtabrams picture adamtabrams  路  3Comments