SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Topic started by: brebey on January 08, 2020, 09:45:27 PM

Title: Adding Comment Support to JSON and Other File Types
Post by: brebey on January 08, 2020, 09:45:27 PM
I want to add "//" as a line-comment indicator in JSON files (*.json), and in other kinds of files, as well.

How do I make SlickEdit recognize "//" as a line-comment indicator in a JSON file so that it will properly color-code the comment lines?
Title: Re: Adding Comment Support to JSON and Other File Types
Post by: Clark on January 09, 2020, 03:57:38 AM
Type the following on the SlickEdit command line:

Code: [Select]
help Color Coding::creating support for a new language

This help item has a lot of how to's including one for adding a line comment
Title: Re: Adding Comment Support to JSON and Other File Types
Post by: brebey on January 09, 2020, 01:58:06 PM
Perfect!  Up and going in 2 minutes.  Very impressive Help detail - kudos, SlickEdit!
Title: Re: Adding Comment Support to JSON and Other File Types
Post by: Stu on January 23, 2020, 03:44:35 PM
as an FYI, comments in JSON make it invalid. There are no comments in JSON by design.
Title: Re: Adding Comment Support to JSON and Other File Types
Post by: brebey on January 23, 2020, 04:19:10 PM
Yes, I understand that about JSON not having "real" comments;  thanks, though, for making the point.  I pre-process my JSON files before deserialization to remove the comments.  They are extremely useful for documenting configuration data, though, so it's worth the extra little step of stripping comments in-memory before deserialization.
Title: Re: Adding Comment Support to JSON and Other File Types
Post by: Stu on January 24, 2020, 01:19:38 PM
I actually do it as well :) As long as you know it makes it invalid and are aware, its all good. Its easy to think its just javacsript and add comments without knowing about it and then wonder why something is broken somewhere.