Thanks to CudaText, it is a definitely great product.
In latest 1.206.2.0 version, I meet such a pain point. If data type is array/list in JSON, all nodes will be displayed in flat style, not structured or wrapped, not easy to address array node by sequence number.
Suggestion:
If data type is array/list in JSON, the element nodes are wrapped with sequence number like [0],[1]...[n]. User click '[0]' icon to unfold specified element data.
Thanks.
[Suggestion]Array/List nodes to be wrapped as [0]..[n] in Code-Tree for JSON data
-
- Posts: 2
- Joined: 26.12.2023 02:50
-
- Posts: 2245
- Joined: 25.08.2021 18:15
Re: [Suggestion]Array/List nodes to be wrapped as [0]..[n] in Code-Tree for JSON data
code-tree for JSON is built by lexer (lexlib/JSON.lcf file).
it don't have the power to calculate [0]...[n] indexes. so it cannot do it.
what you can do:
write the tree-helper in python language.
https://wiki.freepascal.org/CudaText_API#TreeHelpers
when done, maybe you will need to disable the code-tree in JSON.lcf lexer.
https://wiki.freepascal.org/CudaText#Le ... d_creation
open JSON lexer in SynWrite app's editor, and 'disable' all items in the ui-tab for code-tree.
i think that tree-helper will be slower than lexer's work. so I don't want to use your work in distro.
it don't have the power to calculate [0]...[n] indexes. so it cannot do it.
what you can do:
write the tree-helper in python language.
https://wiki.freepascal.org/CudaText_API#TreeHelpers
when done, maybe you will need to disable the code-tree in JSON.lcf lexer.
https://wiki.freepascal.org/CudaText#Le ... d_creation
open JSON lexer in SynWrite app's editor, and 'disable' all items in the ui-tab for code-tree.
i think that tree-helper will be slower than lexer's work. so I don't want to use your work in distro.
-
- Posts: 2245
- Joined: 25.08.2021 18:15
Re: [Suggestion]Array/List nodes to be wrapped as [0]..[n] in Code-Tree for JSON data
I tested with simple JSON array
and here I don't see list items in the code-tree. Tree shows only "p".
Code: Select all
{
"p": [
"1", "2", "3"
]
}
-
- Posts: 2
- Joined: 26.12.2023 02:50
Re: [Suggestion]Array/List nodes to be wrapped as [0]..[n] in Code-Tree for JSON data
@Alexey,
Appreciated for your advice.
Take below json as example.
In Code Tree, it listed like below, it is not easy to identify node1,node2 under which element in list.
It would be more clear and friendly if display as below (as VS Code):
Is it possible to enhance JSON lexer to support '[]' array node type view in code-tree.
thanks.
Appreciated for your advice.
Take below json as example.
Code: Select all
{
"list": [{
"node1": {
"a": 1
},
"node2": {
"a": 1
}
}, {
"node1": {
"a": 1
},
"node2": {
"b": 1
}
}, {
"node1": {
"a": 1
},
"node3": {
"c": 1
}
} ]
}
Code: Select all
"list"
"node1"
"node2"
"node1"
"node2"
"node1"
"node3"
Code: Select all
"list"
[0]
"node1"
"node2"
[1]
"node1"
"node2"
[2]
"node1"
"node3"
thanks.
-
- Posts: 2245
- Joined: 25.08.2021 18:15
Re: [Suggestion]Array/List nodes to be wrapped as [0]..[n] in Code-Tree for JSON data
no, it is not possible to configure lexer in EControl format like this. no counters there.
the solution can be this: create custom tree-helper for JSON lexer (written in Python).
https://wiki.freepascal.org/CudaText#Kinds_of_add-ons
examples:
https://sourceforge.net/projects/cudate ... eehelpers/
the solution can be this: create custom tree-helper for JSON lexer (written in Python).
https://wiki.freepascal.org/CudaText#Kinds_of_add-ons
examples:
https://sourceforge.net/projects/cudate ... eehelpers/