Skip to content

Commit

Permalink
fix issue 23
Browse files Browse the repository at this point in the history
  • Loading branch information
wiggin77 committed Mar 1, 2018
1 parent 46b4d7d commit 78b71c6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Codedox change log

## 1.2.6

* Added `fname`, `fspec`, `frel` parameters; see [issue 23](https://github.com/vshaxe/codedox/issues/23)
* Allow params in any part of method comment

## 1.2.5

* Travis-CI integraton
Expand All @@ -9,7 +14,7 @@
## 1.2.4

* Repo moved to [vshaxe](https://github.com/vshaxe) organization
* Fix [issue 16](https://github.com/vshaxe/codedox/issues/16) support newlines in commentdescription, paramFormat, returnFormat
* Fix [issue 16](https://github.com/vshaxe/codedox/issues/16) support newlines in comment description, paramFormat, returnFormat
* New config option `alwaysMultiline:true`. If true then all comments are multiline, otherwise non-functions (types) are single line
* OnEnter rules dynamically generated for custom configs
* Fix [issue 12](https://github.com/vshaxe/codedox/issues/12) Spaces added for non-function docs
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "codedox",
"displayname": "Codedox for Haxe",
"description": "JSDoc-style comments for Haxe. @param and @return tags, plus customizable file header license and copyright comments.",
"version": "1.2.5",
"version": "1.2.6",
"publisher": "wiggin77",
"license": "(MIT) View license in LICENSE.md",
"engines": {
Expand Down
13 changes: 6 additions & 7 deletions src/wiggin/codedox/Commenter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ class Commenter
{
var strIndent = info.strIndent;
var strPrefix = settings.strCommentPrefix;
var map = new Map<String,String>();

var sb = new StringBuf();
sb.add(strIndent);
Expand Down Expand Up @@ -219,23 +220,21 @@ class Commenter
var mapP = ["name" => item.name, "type" => item.type];
ParamUtil.addDefaultParams(mapP);
var strP = ParamUtil.applyParams(settings.strParamFormat, mapP);

composeCommentLines(sb, strP, strIndent, strPrefix);
}
}

if(StringUtil.hasChars(info.retType) && info.retType != "Void" && StringUtil.hasChars(settings.strReturnFormat))
{
var mapR = ["type" => info.retType];
ParamUtil.addDefaultParams(mapR);
var strR = ParamUtil.applyParams(settings.strReturnFormat, mapR);

composeCommentLines(sb, strR, strIndent, strPrefix);
map.set("type", info.retType);
composeCommentLines(sb, settings.strReturnFormat, strIndent, strPrefix);
}
sb.add(info.strIndent);
sb.add(settings.strCommentEnd);
sb.add("\n");
return sb.toString();

ParamUtil.addDefaultParams(map);
return ParamUtil.applyParams(sb.toString(), map);
}

/**
Expand Down
12 changes: 6 additions & 6 deletions test/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
],
// Codedox settings
"codedox": {
//"paramFormat": "\n@param {${type}} ${name} - \n",
//"returnFormat": "\n@return ${type}\n",
"paramFormat": "${fname} - @param {${type}} ${name} - ",
//"returnFormat": "@return ${type}",
//"alwaysMultiline": false,

//"commentbegin": "/**",
Expand All @@ -25,7 +25,7 @@
//"headerbegin": "/**",
//"headerprefix": " ",
//"headerend": "**/",
"commentdescription": "[Description]\n",
"commentdescription": "${fname} - [Description]\n",

"fileheader": {
"params": {
Expand All @@ -35,9 +35,9 @@
},
"templates": {
"*": [
"${fname}\n",
"${fspec}\n",
"${frel}\n",
"// ${fname}",
"// ${fspec}",
"// ${frel}",
"${license_mit}"
]
}
Expand Down
2 changes: 1 addition & 1 deletion test/Test.hx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Test
trace(getMessage("Hello", 2));
}

private static function getMessage(str:String, num:Int) : String
private static function getMessage(str:String, num:Int) : String
{
return "message: " + str + num;
}
Expand Down

0 comments on commit 78b71c6

Please sign in to comment.