This commit changes JSON from a custom filetype to one with its own lexer, as requested in https://github.com/geany/geany/issues/384#issuecomment-583869454. The lexer is taken from Scintilla's upstream (version 3.10.4).
This has the following effects: - JavaScript comments (//, /* */) are no longer highlighted as comments, since JSON doesn't allow them - Text outside of quotes, except keywords and numbers, is now considered an error, and highlighted as such (in red)
It should also allow keys and string values to be highlighted in different colours, as in many other editors, but I couldn't get that to work.
Stopping comments from being highlighted is the main motivation for this - highlighting them misleads the user into thinking that JSON allows them. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/2454
-- Commit Summary --
* Use Scintilla's JSON lexer for JSON instead of the JavaScript/C++ lexer
-- File Changes --
M data/Makefile.am (2) D data/filedefs/filetypes.JSON.conf (17) A data/filedefs/filetypes.json (32) M scintilla/Makefile.am (1) A scintilla/lexers/LexJSON.cxx (498) M scintilla/scintilla_changes.patch (2) M scintilla/src/Catalogue.cxx (1) M src/editor.c (1) M src/filetypes.c (1) M src/filetypes.h (1) M src/highlighting.c (2) M src/highlightingmappings.h (25)
-- Patch Links --
https://github.com/geany/geany/pull/2454.patch https://github.com/geany/geany/pull/2454.diff