Skip to content

Commit

Permalink
fix(typescript): do not generate docs for function calls
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoomen committed Oct 24, 2020
1 parent d44e9f6 commit 65ae158
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/parsers/typescript.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ export class TypeScriptParserService
) {
switch (node.type) {
case NodeType.MEMBER_EXPRESSION: {
this.result = {
functionName: null,
propertyName: null,
generator: false,
async: false,
typeParameters: [],
parameters: [],
returnType: null,
exceptions: [],
};
const prototypeIdentifier = node.child(0)?.children.pop();
if (prototypeIdentifier && prototypeIdentifier.text === 'prototype') {
if (prototypeIdentifier?.text === 'prototype') {
this.result = {
functionName: null,
propertyName: null,
generator: false,
async: false,
typeParameters: [],
parameters: [],
returnType: null,
exceptions: [],
};
this.runNodeParser(this.parsePrototypeFunction, node);
}
break;
Expand Down
13 changes: 13 additions & 0 deletions test/filetypes/javascript/functions.vader
Original file line number Diff line number Diff line change
Expand Up @@ -372,3 +372,16 @@ Expect javascript (generated comments with a description, @param and @return tag
* @return {[TODO:type]} [TODO:description]
*/
function foo({ a, b: str, c = 3, d: int = 5 }) {}

# ==============================================================================
# Function calls that should not generate documentation
# ==============================================================================
Given javascript (function call):
AdminPermissionModel.create(item);


Do (trigger doge):
\<C-d>

Expect javascript (to not have generated a docblock):
AdminPermissionModel.create(item);

0 comments on commit 65ae158

Please sign in to comment.