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(
Thanks again for your patience,
RF
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
[...]
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.
Using Javascript as a base for JSON makes much more sense, it is after all JavaScript Object Notation :)
Cheers Lex
Cheers, Matthew Brush
[1] http://wiki.geany.org/config/json?rev=1348827879&do=diff
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
On 13-02-22 05:30 PM, Matthew Brush wrote:
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.
Is the [1] in "instead of JavaScript[1]" significant?
I changed filetypes.JSON.conf to:
[styling=C] default=default number=number string=string word=word identifier=identifier,bold
[keywords] primary=true false null
[settings] extension=json lexer_filetype=Javascript comment_single=# comment_use_indent=true
[indentation] width=2 # 0 is spaces, 1 is tabs, 2 is tab & spaces type=0
Syntax highlighting is still not so colourful: Names are bold black and values are normal black unless they are numbers, in which case they are green.
Highlighting of matching '[' and '{' braces works fine after rebooting my PC.
Setting the filetype to Javascript (Document -> Set Filetype -> Scripting Languages -> Javascript) results in a more colourful display, but without any differentiation between names and values.
Is there any way of customizing this without launching a new career?
Please update the wiki if you find it's incorrect.
How do I do that?
Thanks,
RF
On 13-02-23 03:30 PM, Bob Furber wrote:
On 13-02-22 05:30 PM, Matthew Brush wrote:
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.
Is the [1] in "instead of JavaScript[1]" significant?
Scroll down to the bottom of my email.
I changed filetypes.JSON.conf to:
[styling=C] default=default number=number string=string word=word identifier=identifier,bold
Delete everything after [styling=C] there (from "default" to "identifier" keys).
[keywords] primary=true false null [settings] extension=json lexer_filetype=Javascript comment_single=# comment_use_indent=true [indentation] width=2 # 0 is spaces, 1 is tabs, 2 is tab & spaces type=0
Syntax highlighting is still not so colourful: Names are bold black and values are normal black unless they are numbers, in which case they are green.
Because you left YAML styles above maybe (under [styling=C]).
Highlighting of matching '[' and '{' braces works fine after rebooting my PC.
Should never need to reboot PC for anything with Geany, but often making changes to configuration files requires restarting all Geany instances.
Setting the filetype to Javascript (Document -> Set Filetype -> Scripting Languages -> Javascript) results in a more colourful display, but without any differentiation between names and values.
It highlights it the same as JavaScript. I don't know what names and values are in this context, but it highlights quoted "strings" the same no matter where they appear, as far as I know.
Is there any way of customizing this without launching a new career?
Depends how much of the manual you read :)
Please update the wiki if you find it's incorrect.
How do I do that?
Create a login, login, and click "Edit" or whatever it's labeled on the page you want to edit. Pretty much same as any wiki.
Cheers, Matthew Brush
On 13-02-23 04:02 PM, Matthew Brush wrote:
Syntax highlighting is still not so colourful: Names are bold black and values are normal black unless they are numbers, in which case they are green.
Because you left YAML styles above maybe (under [styling=C]).
I cannot see any YAML styles in filetypes.JSON.conf:
[styling=C] default=default number=number string=string word=word identifier=identifier,bold
[keywords] primary=true false null
[settings] extension=json lexer_filetype=Javascript comment_single=# comment_use_indent=true
[indentation] width=2 # 0 is spaces, 1 is tabs, 2 is tab & spaces type=0
I did, however, remove the lines below [styling=C]. But I kept
identifier=identifier,bold
..because it bolds the name in a *Name*:Value pair: { "*err*": "File not found", "*gId*": 28, }
In case the html is stripped out, "*err*" and "*gId*", above, are bold face.
I would prefer a color like blue, to bold, but bold is really quite adequate.
Thanks,
RF
On 13-02-23 05:48 PM, Bob Furber wrote:
On 13-02-23 04:02 PM, Matthew Brush wrote:
Syntax highlighting is still not so colourful: Names are bold black and values are normal black unless they are numbers, in which case they are green.
Because you left YAML styles above maybe (under [styling=C]).
I cannot see any YAML styles in filetypes.JSON.conf:
[styling=C]
Start Deleting lines here...
default=default number=number string=string word=word identifier=identifier,bold
... And Stop deleting lines here
That is what I meant.
Cheers, Matthew Brush
On 13-02-23 06:38 PM, Matthew Brush wrote:
I cannot see any YAML styles in filetypes.JSON.conf:
[styling=C]
Start Deleting lines here...
default=default number=number string=string word=word identifier=identifier,bold
... And Stop deleting lines here
That is what I meant.
No change even after restarting my PC: Names are bold black, values are normal black, numbers are green ..and filetypes.JSON.conf looks like this:
[styling=C]
[keywords] primary=true false null
[settings] extension=json lexer_filetype=Javascript comment_single=# comment_use_indent=true
[indentation] width=2 # 0 is spaces, 1 is tabs, 2 is tab & spaces type=0
RF
On 24 February 2013 13:54, Bob Furber burnsmicro@gmail.com wrote:
On 13-02-23 06:38 PM, Matthew Brush wrote:
I cannot see any YAML styles in filetypes.JSON.conf:
[styling=C]
Start Deleting lines here...
default=default number=number string=string word=word identifier=identifier,bold
... And Stop deleting lines here
That is what I meant.
No change even after restarting my PC: Names are bold black, values are normal black, numbers are green ..and filetypes.JSON.conf looks like this:
I'm not sure what you are expecting to happen?
As I said on another post, you change the colours by choosing the colour scheme. Try alternating between default and alt and you should see at least some difference.
Cheers Lex
[styling=C] [keywords] primary=true false null [settings] extension=json lexer_filetype=Javascript comment_single=# comment_use_indent=true [indentation] width=2 # 0 is spaces, 1 is tabs, 2 is tab & spaces type=0
RF
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
On 13-02-23 06:54 PM, Bob Furber wrote:
On 13-02-23 06:38 PM, Matthew Brush wrote:
I cannot see any YAML styles in filetypes.JSON.conf:
[styling=C]
Start Deleting lines here...
default=default number=number string=string word=word identifier=identifier,bold
... And Stop deleting lines here
That is what I meant.
No change even after restarting my PC: Names are bold black, values are normal black, numbers are green ..and filetypes.JSON.conf looks like this:
What are "names"? AFAIK the only "names" in JSON are the names of builtin identifiers like "true" and "false". Everything else is either an aggregate type (list, dict/hashtable, etc), a quoted "string", or a literal numeric value (like 1 or 1.2, etc). Maybe I misunderstood your terminology or JSON specs?
[styling=C] [keywords] primary=true false null [settings] extension=json lexer_filetype=Javascript
It might be that "Javascript" is not a valid lexer filetype, I've never been clear on this. Perhaps you should use "C" or "CPP" or "C++" or something (whatever makes it use Scintilla's LexCPP.cxx lexer). Maybe someone more knowledgeable can confirm the correct one.
FWIW, I'm pretty sure it worked as in the original wiki entry, otherwise I can't imagine why I'd have posted it.
Cheers, Matthew Brush
On 13-02-23 07:41 PM, Matthew Brush wrote:
No change even after restarting my PC: Names are bold black, values are normal black, numbers are green ..and filetypes.JSON.conf looks like this:
I found it!!
For some reason, I had 2 filetypes.JSON.conf files:
/usr/share/geany/filetypes.JSON.conf and /root/.config/geany/filedefs/filetypes.JSON.conf
This seems to have come about because I accessed Geany in supervisor mode to edit filetypes.JSON.conf.
In the meantime, I have merrily been editing /root/.config/geany/filedefs/filetypes.JSON.conf, while Geany, accessed in user mode uses /usr/share/geany/filetypes.JSON.conf.
What are "names"?
Perhaps I am using Name inappropriately. What I mean is the lowest element in a json file is a name:value pair (i.e., {"myVarName":"myVarValue"}). While not very important, I can see some merit in differentiating the name from the value.
The only way I have found so far to differentiate names from values is by setting lexer_filetype=YAML.
Thanks Matthew & Lex for all your help.
RF
On 25 February 2013 09:43, Bob Furber burnsmicro@gmail.com wrote:
On 13-02-23 07:41 PM, Matthew Brush wrote:
No change even after restarting my PC: Names are bold black, values are normal black, numbers are green ..and filetypes.JSON.conf looks like this:
I found it!!
For some reason, I had 2 filetypes.JSON.conf files:
/usr/share/geany/filetypes.JSON.conf
and /root/.config/geany/filedefs/filetypes.JSON.conf
This seems to have come about because I accessed Geany in supervisor mode to edit filetypes.JSON.conf.
Perhaps the lesson is "Don't try stuff as root", do it as an unprivileged user, thats why we read the user config so users can change it without touching the system stuff :)
And as a user mistakes make less of a mess :)
Cheers Lex
In the meantime, I have merrily been editing /root/.config/geany/filedefs/filetypes.JSON.conf, while Geany, accessed in user mode uses /usr/share/geany/filetypes.JSON.conf.
What are "names"?
Perhaps I am using Name inappropriately. What I mean is the lowest element in a json file is a name:value pair (i.e., {"myVarName":"myVarValue"}). While not very important, I can see some merit in differentiating the name from the value.
The only way I have found so far to differentiate names from values is by setting lexer_filetype=YAML.
Thanks Matthew & Lex for all your help.
RF
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
On 13-02-23 06:54 PM, Bob Furber wrote:
On 13-02-23 06:38 PM, Matthew Brush wrote:
I cannot see any YAML styles in filetypes.JSON.conf:
[styling=C]
Start Deleting lines here...
default=default number=number string=string word=word identifier=identifier,bold
... And Stop deleting lines here
That is what I meant.
No change even after restarting my PC: Names are bold black, values are normal black, numbers are green ..and filetypes.JSON.conf looks like this:
I tried to re-create the filetypes.JSON.conf file from scratch, it works fine (at least for syntax highlighting) using this:
[styling=C]
[keywords] primary=true false null
[settings] extension=js lexer_filetype=Javascript comment_single=# comment_use_indent=true
[indentation] width=2 type=1
Hope it helps.
Cheers, Matthew Brush
On 24 February 2013 10:30, Bob Furber burnsmicro@gmail.com wrote:
On 13-02-22 05:30 PM, Matthew Brush wrote:
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.
Is the [1] in "instead of JavaScript[1]" significant?
I changed filetypes.JSON.conf to:
[styling=C] default=default number=number string=string word=word identifier=identifier,bold [keywords] primary=true false null [settings] extension=json lexer_filetype=Javascript comment_single=# comment_use_indent=true [indentation] width=2 # 0 is spaces, 1 is tabs, 2 is tab & spaces type=0
Syntax highlighting is still not so colourful: Names are bold black and values are normal black unless they are numbers, in which case they are green.
How colourful a language is depends on two things, how language constructs detected by the lexer map to styles, and what the colour scheme defines the style to be (colour, bold, italic, etc).
The former is saying *what* can be coloured and the latter *how* it will be coloured. The *what* is hard coded, and javascript and YAML have similar numbers of detected constructs, but they are different constructs.
The *how* is intended to be configurable by users by:
1) just select a new colour scheme menu->view->editor->colour schemes, Geany only comes with two (for now), but you can get heaps of *colourful* schemes here https://github.com/codebrainz/geany-themes
2) by making your own theme, see the manual and the wiki for how, and the themes above for examples (pick one, rename it and change the bits you don't like)
3) as a last resort by changing the styling section in your filetype file, but of course this will prevent it following the colour scheme.
Highlighting of matching '[' and '{' braces works fine after rebooting my PC.
Setting the filetype to Javascript (Document -> Set Filetype -> Scripting Languages -> Javascript) results in a more colourful display, but without any differentiation between names and values.
Is there any way of customizing this without launching a new career?
Some people have made a "career" out of creating themes :)
Cheers Lex
Please update the wiki if you find it's incorrect.
How do I do that?
Thanks,
RF
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users