Skip to content

Commit 8cab33d

Browse files
committed
[SELF-INCOMPATIBLE] json-wrier: add "kindName" pair when printing TAG_ROLE_DESCRIPTION
With the original code, json-writer emits the following form for TAG_ROLE_DESCRIPTION: {"_type": "ptag", "name": "TAG_ROLE_DESCRIPTION", "parserName": "LANG!KIND", ... This commit changes the form like: {"_type": "ptag", "name": "TAG_ROLE_DESCRIPTION", "parserName": "LANG", "kindName": "KIND", ... This change is kept invisble to uesrs while the file format is 0.0. Close #3556. Signed-off-by: Masatake YAMATO <[email protected]>
1 parent 9fd8d5d commit 8cab33d

File tree

3 files changed

+60
-7
lines changed

3 files changed

+60
-7
lines changed

docs/man/ctags-json-output.5.rst

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ctags-json-output
66

77
JSON based ctags output
88

9-
:Version: 0.0
9+
:Version: 1.0
1010
:Manual group: Universal Ctags
1111
:Manual section: 5
1212

@@ -28,7 +28,7 @@ Each JSON line represents a tag.
2828
.. code-block:: console
2929
3030
$ ctags --extras=+p --output-format=json --fields=-s input.py
31-
{"_type": "ptag", "name": "JSON_OUTPUT_VERSION", "path": "0.0", "pattern": "in development"}
31+
{"_type": "ptag", "name": "JSON_OUTPUT_VERSION", "path": "1.0", "pattern": "in development"}
3232
{"_type": "ptag", "name": "TAG_FILE_SORTED", "path": "1", "pattern": "0=unsorted, 1=sorted, 2=foldcase"}
3333
...
3434
{"_type": "tag", "name": "Klass", "path": "/tmp/input.py", "pattern": "/^class Klass:$/", "language": "Python", "kind": "class"}
@@ -45,7 +45,7 @@ is ``tag``, the JSON line represents a regular tag. If the value is
4545

4646
The output format can be changed in the
4747
future. ``JSON_OUTPUT_VERSION`` pseudo-tag provides a change
48-
client-tools to handle the changes. Current version is "0.0". A
48+
client-tools to handle the changes. Current version is "1.0". A
4949
client-tool can extract the version with ``path`` key from the
5050
pseudo-tag.
5151

@@ -92,6 +92,32 @@ used in a field of JSON.
9292

9393
For an example, the value for ``pattern`` field of ctags takes a string or a boolean value.
9494

95+
VERSIONS
96+
--------
97+
98+
Cnages since "0.0"
99+
~~~~~~~~~~~~~~~~~~
100+
101+
* New key ``kindName`` for ``TAG_ROLE_DESCRIPTION`` pseudo tag
102+
103+
``kindName`` is added to store the name of the kind in ``TAG_ROLE_DESCRIPTION``
104+
pseudo tags.
105+
106+
In 0.0, a "TAG_ROLE_DESCRIPTION" pseudo tag was printed like:
107+
108+
.. code-block:: JSON
109+
110+
{"_type": "ptag", "name": "TAG_ROLE_DESCRIPTION",
111+
"parserName": "LANG!KIND", }
112+
113+
In 1.0, it is printed like:
114+
115+
.. code-block:: JSON
116+
117+
{"_type": "ptag", "name": "TAG_ROLE_DESCRIPTION",
118+
"parserName": "LANG",
119+
"kindName": "KIND", }
120+
95121
SEE ALSO
96122
--------
97123
:ref:`ctags(1) <ctags(1)>`, :ref:`tags(5) <tags(5)>`, :ref:`ctags-client-tools(7) <ctags-client-tools(7)>`

main/ptag.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ static ptagDesc ptagDescs [] = {
185185
{ true, "TAG_ROLE_DESCRIPTION",
186186
"the names and descriptions of enabled roles",
187187
ptagMakeRoleDescriptions,
188-
PTAGF_PARSER },
188+
PTAGF_PARSER,
189+
.jsonObjectKey = "kindName" },
189190
{ true, "TAG_OUTPUT_MODE",
190191
"the output mode: u-ctags or e-ctags",
191192
ptagMakeCtagsOutputMode,

man/ctags-json-output.5.rst.in

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ctags-json-output
66
---------------------------------------------------------------------------------
77
JSON based ctags output
88
---------------------------------------------------------------------------------
9-
:Version: 0.0
9+
:Version: 1.0
1010
:Manual group: Universal Ctags
1111
:Manual section: 5
1212

@@ -28,7 +28,7 @@ Each JSON line represents a tag.
2828
.. code-block:: console
2929

3030
$ ctags --extras=+p --output-format=json --fields=-s input.py
31-
{"_type": "ptag", "name": "JSON_OUTPUT_VERSION", "path": "0.0", "pattern": "in development"}
31+
{"_type": "ptag", "name": "JSON_OUTPUT_VERSION", "path": "1.0", "pattern": "in development"}
3232
{"_type": "ptag", "name": "TAG_FILE_SORTED", "path": "1", "pattern": "0=unsorted, 1=sorted, 2=foldcase"}
3333
...
3434
{"_type": "tag", "name": "Klass", "path": "/tmp/input.py", "pattern": "/^class Klass:$/", "language": "Python", "kind": "class"}
@@ -45,7 +45,7 @@ is ``tag``, the JSON line represents a regular tag. If the value is
4545

4646
The output format can be changed in the
4747
future. ``JSON_OUTPUT_VERSION`` pseudo-tag provides a change
48-
client-tools to handle the changes. Current version is "0.0". A
48+
client-tools to handle the changes. Current version is "1.0". A
4949
client-tool can extract the version with ``path`` key from the
5050
pseudo-tag.
5151

@@ -92,6 +92,32 @@ used in a field of JSON.
9292

9393
For an example, the value for ``pattern`` field of ctags takes a string or a boolean value.
9494

95+
VERSIONS
96+
--------
97+
98+
Cnages since "0.0"
99+
~~~~~~~~~~~~~~~~~~
100+
101+
* New key ``kindName`` for ``TAG_ROLE_DESCRIPTION`` pseudo tag
102+
103+
``kindName`` is added to store the name of the kind in ``TAG_ROLE_DESCRIPTION``
104+
pseudo tags.
105+
106+
In 0.0, a "TAG_ROLE_DESCRIPTION" pseudo tag was printed like:
107+
108+
.. code-block:: JSON
109+
110+
{"_type": "ptag", "name": "TAG_ROLE_DESCRIPTION",
111+
"parserName": "LANG!KIND", }
112+
113+
In 1.0, it is printed like:
114+
115+
.. code-block:: JSON
116+
117+
{"_type": "ptag", "name": "TAG_ROLE_DESCRIPTION",
118+
"parserName": "LANG",
119+
"kindName": "KIND", }
120+
95121
SEE ALSO
96122
--------
97123
ctags(1), tags(5), ctags-client-tools(7)

0 commit comments

Comments
 (0)