Bug 383286 - Highlight JSON errors
Summary: Highlight JSON errors
Status: RESOLVED INTENTIONAL
Alias: None
Product: frameworks-syntax-highlighting
Classification: Frameworks and Libraries
Component: syntax (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-08 16:20 UTC by Jaime Torres
Modified: 2017-09-18 19:18 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jaime Torres 2017-08-08 16:20:05 UTC
In JSON, the arrays and dictionaries can't have a trailing ",".
But they are very hard to catch by the human eye without colouring help (I know, I've lost more than one hour because of them).

It would be very nice if those errors (and probably others) are highlighted with inverted foreground and background.
Comment 1 Dominik Haumann 2017-09-18 17:03:51 UTC
Can you provide a piece of sample code you are talking about?

It may very well be that your request is out of scope, since we cannot look into the "future", i.e. following lines, to mark a ',' as error.

For real syntax checks, you typically use a linter.
Comment 2 Jaime Torres 2017-09-18 18:20:21 UTC
Something like this:
{"node1":["child1","child2",],["other1","other2"],}
where the last comma of the first array and the last comma of the dictionary, in the middle of a one page json are almost invisible.

If this is not possible, is there a json lint that can be integrated with kate, I mean that kate is able to call it with the current file and understand the lint output?
Comment 3 Dominik Haumann 2017-09-18 19:13:33 UTC
If it is in the same line like in your example: {"node1":["child1","child2",],["other1","other2"],}

Then it will work.

However, as soon as you have
{"node1":[
     "child1",
     "child2",
  ],
  [
     "other1",
     "other2"],
}

Then it will not work anymore. Which is also kind of inconsistent... Not yet convinced we should add this.
Comment 4 Jaime Torres 2017-09-18 19:18:58 UTC
If you are not convinced, then let's postpone this wish until there is a cheap way to not just highlight the right syntax elements but also the wrong ones.