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

another missing comma error syntax #34

Closed
itchyny opened this issue Jul 9, 2014 · 4 comments
Closed

another missing comma error syntax #34

itchyny opened this issue Jul 9, 2014 · 4 comments

Comments

@itchyny
Copy link

itchyny commented Jul 9, 2014

There are some error syntax which the syntax file does not warn us.
First case:

[
  { "object1": 1 }
  { "object2": 2 }
]

should be

[
  { "object1": 1 },
  { "object2": 2 }
]

Second case:

{
  "object1": []
  "object2": []
}

should be

{
  "object1": [],
  "object2": []
}

Also missing comma after literals like true/false, {}.

{
  "object1": true
  "object2": 2
}
@CaptSpify
Copy link

@itchyny
This is affected by the "syn regions" on line 90. I made this change to mine to get it working:
CaptSpify@9d2fa59

@elzr
Copy link
Owner

elzr commented Aug 22, 2014

Thanks @itchyny and @CaptSpify. I had known about these unhighlighted cases but frankly they were something of a pain to deal with because of how Vim won't allow you to reuse a keyword or a region as part of a match. In other words, it seemed to be either I highlighted these edge cases or I recognized true/false and {} & [] regions properly (important for folding).

Anyway, I finally found a way to do both. It adds some regex complexity but hopefully nothing that will hurt performance.

Added these new cases to the test file json-test.json. This is what you should see:
image

@elzr elzr closed this as completed Aug 22, 2014
elzr added a commit that referenced this issue Aug 22, 2014
@itchyny
Copy link
Author

itchyny commented Aug 22, 2014

Works nice. Thank you @elzr.

@CaptSpify
Copy link

@elzr
I ran into the same issues trying to fix it, which is why I did the hacky work-around.
Good stuff. I'll test it out tomorrow, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants