diff --git a/test/fixture/infer-params.input.js b/test/fixture/infer-params.input.js index c544ae5..f781408 100644 --- a/test/fixture/infer-params.input.js +++ b/test/fixture/infer-params.input.js @@ -13,3 +13,15 @@ function addThem(a, b, c, { d, e, f }) { function fishesAndFoxes({ fishes, foxes }) { return fishes + foxes; } + +/** + * This is foo's documentation + */ +class Foo { + /** + * The method + * @param {number} x Param to method + */ + method(x) { + } +} diff --git a/test/fixture/infer-params.output.json b/test/fixture/infer-params.output.json index 4b0d6ee..394632b 100644 --- a/test/fixture/infer-params.output.json +++ b/test/fixture/infer-params.output.json @@ -34,7 +34,7 @@ "column": 1 } }, - "code": "/**\n * This function returns the number one.\n * @param {number} b the second param\n */\nfunction addThem(a, b, c, { d, e, f }) {\n return a + b + c + d + e + f;\n}\n\n/**\n * This method has partially inferred params\n * @param {String} $0.fishes number of kinds of fish\n */\nfunction fishesAndFoxes({ fishes, foxes }) {\n return fishes + foxes;\n}\n" + "code": "/**\n * This function returns the number one.\n * @param {number} b the second param\n */\nfunction addThem(a, b, c, { d, e, f }) {\n return a + b + c + d + e + f;\n}\n\n/**\n * This method has partially inferred params\n * @param {String} $0.fishes number of kinds of fish\n */\nfunction fishesAndFoxes({ fishes, foxes }) {\n return fishes + foxes;\n}\n\n/**\n * This is foo's documentation\n */\nclass Foo {\n /**\n * The method\n * @param {number} x Param to method\n */\n method(x) {\n }\n}\n" }, "errors": [], "params": [ @@ -129,7 +129,7 @@ "column": 1 } }, - "code": "/**\n * This function returns the number one.\n * @param {number} b the second param\n */\nfunction addThem(a, b, c, { d, e, f }) {\n return a + b + c + d + e + f;\n}\n\n/**\n * This method has partially inferred params\n * @param {String} $0.fishes number of kinds of fish\n */\nfunction fishesAndFoxes({ fishes, foxes }) {\n return fishes + foxes;\n}\n" + "code": "/**\n * This function returns the number one.\n * @param {number} b the second param\n */\nfunction addThem(a, b, c, { d, e, f }) {\n return a + b + c + d + e + f;\n}\n\n/**\n * This method has partially inferred params\n * @param {String} $0.fishes number of kinds of fish\n */\nfunction fishesAndFoxes({ fishes, foxes }) {\n return fishes + foxes;\n}\n\n/**\n * This is foo's documentation\n */\nclass Foo {\n /**\n * The method\n * @param {number} x Param to method\n */\n method(x) {\n }\n}\n" }, "errors": [], "params": [ @@ -168,5 +168,106 @@ "path": [ "fishesAndFoxes" ] + }, + { + "description": "This is foo's documentation", + "tags": [], + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 19, + "column": 3 + } + }, + "context": { + "loc": { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 27, + "column": 1 + } + }, + "code": "/**\n * This function returns the number one.\n * @param {number} b the second param\n */\nfunction addThem(a, b, c, { d, e, f }) {\n return a + b + c + d + e + f;\n}\n\n/**\n * This method has partially inferred params\n * @param {String} $0.fishes number of kinds of fish\n */\nfunction fishesAndFoxes({ fishes, foxes }) {\n return fishes + foxes;\n}\n\n/**\n * This is foo's documentation\n */\nclass Foo {\n /**\n * The method\n * @param {number} x Param to method\n */\n method(x) {\n }\n}\n" + }, + "errors": [], + "name": "Foo", + "kind": "class", + "members": { + "instance": [ + { + "description": "The method", + "tags": [ + { + "title": "param", + "description": "Param to method", + "lineNumber": 2, + "type": { + "type": "NameExpression", + "name": "number" + }, + "name": "x" + } + ], + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 24, + "column": 5 + } + }, + "context": { + "loc": { + "start": { + "line": 25, + "column": 2 + }, + "end": { + "line": 26, + "column": 3 + } + }, + "code": "/**\n * This function returns the number one.\n * @param {number} b the second param\n */\nfunction addThem(a, b, c, { d, e, f }) {\n return a + b + c + d + e + f;\n}\n\n/**\n * This method has partially inferred params\n * @param {String} $0.fishes number of kinds of fish\n */\nfunction fishesAndFoxes({ fishes, foxes }) {\n return fishes + foxes;\n}\n\n/**\n * This is foo's documentation\n */\nclass Foo {\n /**\n * The method\n * @param {number} x Param to method\n */\n method(x) {\n }\n}\n" + }, + "errors": [], + "params": [ + { + "title": "param", + "description": "Param to method", + "lineNumber": 2, + "type": { + "type": "NameExpression", + "name": "number" + }, + "name": "x" + } + ], + "name": "method", + "kind": "function", + "memberof": "Foo", + "scope": "instance", + "members": { + "instance": [], + "static": [] + }, + "path": [ + "Foo", + "method" + ] + } + ], + "static": [] + }, + "path": [ + "Foo" + ] } ] \ No newline at end of file diff --git a/test/fixture/infer-params.output.md b/test/fixture/infer-params.output.md index 223082e..c262164 100644 --- a/test/fixture/infer-params.output.md +++ b/test/fixture/infer-params.output.md @@ -21,3 +21,15 @@ This method has partially inferred params - `$0` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** - `$0.fishes` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** number of kinds of fish - `$0.foxes` + +# Foo + +This is foo's documentation + +## method + +The method + +**Parameters** + +- `x` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Param to method diff --git a/test/fixture/infer-params.output.md.json b/test/fixture/infer-params.output.md.json index 2163c1a..71d4002 100644 --- a/test/fixture/infer-params.output.md.json +++ b/test/fixture/infer-params.output.md.json @@ -466,6 +466,171 @@ ] } ] + }, + { + "depth": 1, + "type": "heading", + "children": [ + { + "type": "text", + "value": "Foo" + } + ] + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "This is foo's documentation", + "position": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 28 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 28 + }, + "indent": [] + } + }, + { + "depth": 2, + "type": "heading", + "children": [ + { + "type": "text", + "value": "method" + } + ] + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "The method", + "position": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 11 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 11 + }, + "indent": [] + } + }, + { + "type": "strong", + "children": [ + { + "type": "text", + "value": "Parameters" + } + ] + }, + { + "ordered": false, + "type": "list", + "children": [ + { + "type": "listItem", + "children": [ + { + "type": "paragraph", + "children": [ + { + "type": "inlineCode", + "value": "x" + }, + { + "type": "text", + "value": " " + }, + { + "type": "strong", + "children": [ + { + "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", + "type": "link", + "children": [ + { + "type": "text", + "value": "number" + } + ] + } + ] + }, + { + "type": "text", + "value": " " + }, + { + "type": "paragraph", + "children": [ + { + "type": "text", + "value": "Param to method", + "position": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 16 + }, + "indent": [] + } + } + ], + "position": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 16 + }, + "indent": [] + } + } + ] + } + ] + } + ] } ] } \ No newline at end of file