[Geany-Users] adding json support

Matthew Brush mbrush at xxxxx
Sat Feb 23 01:30:36 UTC 2013


On 13-02-22 03:47 PM, Bob Furber wrote:
> On 13-02-22 03:08 PM, Lex Trotman wrote:
>>> >But, where can I find the content of this check_json script file?
>> Its on the wiki as:
>>
>> #!/bin/bash
>> if which python >/dev/null ; then
>>    python -m json.tool <$1 2>&1 >/dev/null \
>>    | sed 's/^\([^:]*\): line \(.*\)/'$1':\2: \1/'
>> elif which perl >/dev/null ; then
>>    perl -MJSON -e 'local $/;decode_json(<STDIN>);' <$1 2>&1 >/dev/null \
>>    |sed 's/^\(.*\) at .e line 1, .STDIN. [^ ]* \([0-9]*\)/'$1':\2: \1/;'
>> else
>>    echo "No known JSON parsers found" >&2
>>    exit 1
>> fi
>>
>
> Doh!
>
> I took "For people using Unix, the following will be helpful for
> checking your JSON files for correctness." too literally and did not
> think it applied to Linux ..causing a lot of bother as a result.
>
> Now any .json file is recognized as such and there is a hint of context
> sensitive highlighting: bolded variable names and green numbers. My next
> job will be to try to expand and embellish  the context sensitive
> highlighting.
>
> But, one problem I have run into is the opening/closing brace/bracket
> check is disabled for filetype: JSON. I can enable it by Document -> Set
> filetype -> NONE ..precisely where I started a couple of days ago  :o(
>

Someone changed my wiki entry so the filetype is YAML instead of 
JavaScript[1]. Set it back to JavaScript and set the `[styling]` section 
back to `[styling=C]`, removing the partial set of styles added in that 
change and highlighting should work perfect (after all, isn't JSON valid 
JavaScript syntax?). You can check "Old Revisions" on the wiki to see 
the original entry and the additions later on.

Please update the wiki if you find it's incorrect.

Cheers,
Matthew Brush

[1] http://wiki.geany.org/config/json?rev=1348827879&do=diff



More information about the Users mailing list