jsdoc2md / jsdoc-parse

parses jsdoc documentation from javascript or html files, outputs JSON
MIT License
99 stars 19 forks source link

Line numbers missing #12

Closed jancbeck closed 8 years ago

jancbeck commented 9 years ago

How would I get the position of a function or method in the code of a given file?

75lb commented 9 years ago

you can get that information from the raw jsdoc output, a command like

$ jsdoc lib/your-code.js -X

or are you saying it should be in the jsdoc-parse output too? to support which feature? maybe it should be considered, let me know.

75lb commented 9 years ago

coincidentally, i just received a PR which adds the jsdoc meta information (which includes line numbers) to the jsdoc-parse output.. i'll let you know once it's available.

jancbeck commented 9 years ago

I locally applied the PR and it seems to be exactly what I wanted

  {
    "id": "sync~fallback",
    "longname": "sync~fallback",
    "name": "fallback",
    "scope": "inner",
    "kind": "member",
    "description": "Call wp.media.model.Attachments.sync or Backbone.sync",
    "memberof": "sync",
    "meta": {
      "range": [
        34830,
        34902
      ],
      "filename": "media-models.js",
      "lineno": 1253,
      "path": "/srv/www/developer-reference/htdocs/wp-includes/js",
      "code": {
        "id": "astnode100003781",
        "name": "fallback",
        "type": "ConditionalExpression",
        "funcscope": "sync",
        "value": "",
        "paramnames": []
      }
    },
    "order": 53
  },

I'm building a documentation with references to the source so the line numbers are essential to associate them.

75lb commented 8 years ago

released in jsdoc-parse v1.2 (and jsdoc2md v1.3).. the json output now has the .meta property containing line number, path and filename.. let me know if you have any more issues!