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) JSON snippet detected as CSS #3406

Closed
ushkal opened this issue Nov 22, 2021 · 1 comment
Closed

(json) JSON snippet detected as CSS #3406

ushkal opened this issue Nov 22, 2021 · 1 comment
Labels
auto-detect Issue with auto detection of language type bug cantfix / wontfix Impossible to fix help welcome Could use help from community language

Comments

@ushkal
Copy link

ushkal commented Nov 22, 2021

Describe the issue
JSON code is detected as CSS.

Which language seems to have the issue?
JSON

Are you using highlight or highlightAuto?
hihjlightAuto
...

Sample Code to Reproduce

JSFiddle: https://jsfiddle.net/zf72nht1/

A sample is

{
    "agent" : "Fivetran Google Cloud Functions Connector/<external_id>/<schema>",
    "state": {
        "cursor": "2020-01-01T00:00:00Z"
    },
    "secrets": {
        "apiToken": "fake_api_token"
    }
}

Expected behavior

It should be detected as JSON

Additional context

We are using v11.2 and in this case the detected language is Smalltalk. But the issue is reproducing in the latest version

@ushkal ushkal added bug help welcome Could use help from community language labels Nov 22, 2021
@joshgoebel joshgoebel added auto-detect Issue with auto detection of language type cantfix / wontfix Impossible to fix labels Nov 29, 2021
@joshgoebel
Copy link
Member

The relevance scoring here is close (8 vs 9, JSON vs CSS)... Sadly, auto-detect is "best effort" and not perfect. #1213 Cases like this are expected and not considered a bug. To always get 100% correct highlighting you need to manually specify the grammar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-detect Issue with auto detection of language type bug cantfix / wontfix Impossible to fix help welcome Could use help from community language
Projects
None yet
Development

No branches or pull requests

2 participants