Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON highlighting doesn't look right #1099

Closed
flowchartsman opened this issue Jul 6, 2020 · 9 comments
Closed

JSON highlighting doesn't look right #1099

flowchartsman opened this issue Jul 6, 2020 · 9 comments
Labels
syntax-highlighting upstream-error A bug in an upstream component

Comments

@flowchartsman
Copy link

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)

@flowchartsman flowchartsman added the bug Something isn't working label Jul 6, 2020
@eth-p
Copy link
Collaborator

eth-p commented Jul 7, 2020

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 7ba5bc7 seem to be the culprit.


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

@eth-p eth-p added syntax-highlighting upstream-error A bug in an upstream component labels Jul 7, 2020
@flowchartsman
Copy link
Author

flowchartsman commented Jul 10, 2020

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

@sharkdp
Copy link
Owner

sharkdp commented Jul 26, 2020

Thank you for reporting this!

In order to prevent bugs like this in the future, I'd like to implement what I proposed here: #988 (comment) We should probably open a new ticket for that.

@flowchartsman
Copy link
Author

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.

@sharkdp
Copy link
Owner

sharkdp commented Jul 30, 2020

That sounds great!

@sharkdp
Copy link
Owner

sharkdp commented Aug 3, 2020

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

@sharkdp
Copy link
Owner

sharkdp commented Feb 28, 2021

Fixed in #1557

@sharkdp sharkdp closed this as completed Feb 28, 2021
@Kabouik
Copy link

Kabouik commented Sep 1, 2021

Except from Monokai, I am experiencing the same issue with pretty much every other bat theme I tried. It's okay for me if at least one dark theme correctly highlights json, but it seems off that the other themes would still suffer from the same issue, so I'm just commenting here in case no one noticed.

@keith-hall
Copy link
Collaborator

Thanks for mentioning it, but it's to be expected. We have only patched Monokai, and none of the other color schemes/themes have been updated or patched to color JSON more nicely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
syntax-highlighting upstream-error A bug in an upstream component
Projects
None yet
Development

No branches or pull requests

5 participants