Skip to content

How to add a comment feature to json-mode? #28

Closed
@hakonhagland

Description

@hakonhagland

I am trying to add a comment feature to the JSON format. Although the regular JSON format does not accept comments, I have written a Perl script that can parse such a file. A comment starts with the # sign as in Shell scripts. What I would like to achieve, is to add syntax highlighting for comments in Emacs, while still using the nice highlighting features of your Emacs json-mode. However, this is complicated by the fact that json-mode does not use syntax highlighting for regular strings, instead it uses font-lock keywords. I think I understand why this is done: the ordinary (built-in) syntax highlighting for strings cannot differentiate between key strings and value strings, so you chose to use font-lock keywords instead? See this question at emacs.stackexchange.com for more information about the problem:

http://emacs.stackexchange.com/questions/9840/how-to-use-font-lock-to-highlight-end-of-line-comments

Any suggestions on how to achieve this (preferably using syntax highlighting and not font lock keywords)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions