json doc info also includes line,col information
This commit is contained in:
parent
093b1bae64
commit
6bbb25f2d7
1 changed files with 4 additions and 3 deletions
|
|
@ -500,8 +500,8 @@ proc genJsonItem(d: PDoc, n, nameNode: PNode, k: TSymKind): JsonNode =
|
||||||
|
|
||||||
initTokRender(r, n, {renderNoBody, renderNoComments, renderDocComments})
|
initTokRender(r, n, {renderNoBody, renderNoComments, renderDocComments})
|
||||||
|
|
||||||
result = %{ "name": %name, "type": %($k) }
|
result = %{ "name": %name, "type": %($k), "line": %n.info.line,
|
||||||
|
"col": %n.info.col}
|
||||||
if comm != nil and comm != "":
|
if comm != nil and comm != "":
|
||||||
result["description"] = %comm
|
result["description"] = %comm
|
||||||
if r.buf != nil:
|
if r.buf != nil:
|
||||||
|
|
@ -559,7 +559,8 @@ proc generateJson*(d: PDoc, n: PNode) =
|
||||||
of nkCommentStmt:
|
of nkCommentStmt:
|
||||||
if n.comment != nil and startsWith(n.comment, "##"):
|
if n.comment != nil and startsWith(n.comment, "##"):
|
||||||
let stripped = n.comment.substr(2).strip
|
let stripped = n.comment.substr(2).strip
|
||||||
d.add %{ "comment": %stripped }
|
d.add %{ "comment": %stripped, "line": %n.info.line,
|
||||||
|
"col": %n.info.col }
|
||||||
of nkProcDef:
|
of nkProcDef:
|
||||||
when useEffectSystem: documentRaises(n)
|
when useEffectSystem: documentRaises(n)
|
||||||
d.add genJsonItem(d, n, n.sons[namePos], skProc)
|
d.add genJsonItem(d, n, n.sons[namePos], skProc)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue