Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
config:json [2013/09/11 09:39] – replace "filetypes_extensions.conf" by "filetype_extensions.conf" (remove 's' from "filetype") cyrille37config:json [2014/11/27 00:54] – Use lexer filetype "Javascritp" to be more straightforward (but it's the same in the end) colombanw
Line 1: Line 1:
 ====== JSON Filetype ====== ====== JSON Filetype ======
-JSON files are intended for serializing data objects, but are sometimes used as configuration files.  YAML is a superset of JSON, but the differences are minor enough that the YAML lexxer built into Geany still works to appropriately identify structures and for folding large lists.+JSON files are intended for serializing data objects, but are sometimes used as configuration files.  JSON syntax is mostly subset of JavaScript syntax and therefore the JavaScript lexer can be used for it.
  
 Add this to the ''filetype_extensions.conf'' file (''...'' means existing data): Add this to the ''filetype_extensions.conf'' file (''...'' means existing data):
Line 17: Line 17:
 And create a new filedef named ''filetypes.JSON.conf'' with the following contents: And create a new filedef named ''filetypes.JSON.conf'' with the following contents:
 <file properties filetypes.JSON.conf> <file properties filetypes.JSON.conf>
-[styling] +[styling=C]
-default=default +
-number=number +
-string=string +
-word=word +
-identifier=identifier,bold+
  
 [keywords] [keywords]
Line 28: Line 23:
  
 [settings] [settings]
-lexer_filetype=YAML+lexer_filetype=Javascript
 extension=json extension=json
-comment_single=+mime_type=application/json
  
 [indentation] [indentation]
-width=2+#width=4
 # 0 is spaces, 1 is tabs, 2 is tab & spaces # 0 is spaces, 1 is tabs, 2 is tab & spaces
-type=0+#type=1
 </file> </file>
  
Line 43: Line 38:
  
 <file bash /usr/local/bin/check_json> <file bash /usr/local/bin/check_json>
-#!/bin/bash+#!/bin/sh
  
 if which python >/dev/null ; then if which python >/dev/null ; then
-  python -m json.tool <$1 2>&1 >/dev/null \ +  python -m json.tool <"$12>&1 >/dev/null \ 
-  | sed 's/^\([^:]*\): line \(.*\)/'$1':\2: \1/'+  | sed 's/^\([^:]*\): line \(.*\)/'"$1"':\2: \1/'
 elif which perl >/dev/null ; then elif which perl >/dev/null ; then
-  perl -MJSON -e 'local $/;decode_json(<STDIN>);' <$1 2>&1 >/dev/null \ +  perl -MJSON -e 'local $/;decode_json(<STDIN>);' <"$12>&1 >/dev/null \ 
-  |sed 's/^\(.*\) at .e line 1, .STDIN. [^ ]* \([0-9]*\)/'$1':\2: \1/;'+  |sed 's/^\(.*\) at .e line 1, .STDIN. [^ ]* \([0-9]*\)/'"$1"':\2: \1/;'
 else else
   echo "No known JSON parsers found" >&2   echo "No known JSON parsers found" >&2
Print/export