diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-07-23 23:23:47 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2016-07-23 23:23:47 +0200 |
commit | 6bbb25f2d7be66b67545c7d52b8f7f67ad56f88f (patch) | |
tree | 5f9e21c694a45bfde2a0f41d34a1b49dafd5ca92 | |
parent | 093b1bae64b7cf8c67c9a684c87e9188427d96d6 (diff) | |
download | Nim-6bbb25f2d7be66b67545c7d52b8f7f67ad56f88f.tar.gz |
json doc info also includes line,col information
-rw-r--r-- | compiler/docgen.nim | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/docgen.nim b/compiler/docgen.nim index dd1f477d3..bbbec081a 100644 --- a/compiler/docgen.nim +++ b/compiler/docgen.nim @@ -500,8 +500,8 @@ proc genJsonItem(d: PDoc, n, nameNode: PNode, k: TSymKind): JsonNode = 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 != "": result["description"] = %comm if r.buf != nil: @@ -559,7 +559,8 @@ proc generateJson*(d: PDoc, n: PNode) = of nkCommentStmt: if n.comment != nil and startsWith(n.comment, "##"): 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: when useEffectSystem: documentRaises(n) d.add genJsonItem(d, n, n.sons[namePos], skProc) |