Skip to content

Commit

Permalink
Fixed #68 that incorrect for properties
Browse files Browse the repository at this point in the history
  • Loading branch information
kasecato committed Jul 7, 2018
1 parent b3c8343 commit 603dd74
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Domain/Lang/DocommentDomainCSharp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export class DocommentDomainCSharp extends DocommentDomain {
let genericList: Array<string> = null;
let paramNameList: Array<string> = null;
let hasReturn = false;
let hasValue = false;

switch (codeType) {
case CodeType.Namespace:
Expand Down Expand Up @@ -158,7 +159,7 @@ export class DocommentDomainCSharp extends DocommentDomain {
case CodeType.Field:
break;
case CodeType.Property:
hasReturn = SyntacticAnalysisCSharp.HasPropertyReturn(code);
hasValue = true;
break;
case CodeType.Comment:
return '/// ';
Expand All @@ -168,7 +169,7 @@ export class DocommentDomainCSharp extends DocommentDomain {
return '';
}

return this.GeneSummary(code, genericList, paramNameList, hasReturn);
return this.GeneSummary(code, genericList, paramNameList, hasReturn, hasValue);
}

/* @implements */
Expand Down Expand Up @@ -208,7 +209,7 @@ export class DocommentDomainCSharp extends DocommentDomain {
* Private Method
*-----------------------------------------------------------------------*/

private GeneSummary(code: string, genericList: Array<string>, paramNameList: Array<string>, hasReturn: boolean): string {
private GeneSummary(code: string, genericList: Array<string>, paramNameList: Array<string>, hasReturn: boolean, hasValue: boolean): string {

let docommentList: Array<string> = new Array<string>();

Expand Down Expand Up @@ -236,6 +237,11 @@ export class DocommentDomainCSharp extends DocommentDomain {
docommentList.push('<returns></returns>');
}

/* <value> */
if (hasValue) {
docommentList.push('<value></value>');
}

// Format
const indentBaseLine: string = this._vsCodeApi.ReadLineAtCurrent();
const indent: string = StringUtil.GetIndent(code, indentBaseLine, this._config.insertSpaces, this._config.detectIdentation);
Expand Down
2 changes: 2 additions & 0 deletions test/TestData/X.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public void Testing2(string String1, string String2, string String3) : base() {
public string Test<T>(T obj) where T : class { }
public static BoolVector operator |(BoolScalar a, BoolVector b) { }
public string[] ss = new string[2] { }
public string Foo { get; set; }
public string Bar { get; set; } = "bar";
}
class NodeItem<T> where T : System.IComparable<T>, new() { }
class SpecialNodeItem<T> : NodeItem<T> where T : System.IComparable<T>, new() { }
Expand Down

0 comments on commit 603dd74

Please sign in to comment.