diff --git a/.gitignore b/.gitignore index fb237b5..f4b10be 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules *.vsix coverage .vscode-test +npm-debug.log diff --git a/images/docomment.png b/images/docomment.png index ac5384d..b9cecd1 100644 Binary files a/images/docomment.png and b/images/docomment.png differ diff --git a/package.json b/package.json index 34e17ed..a801eef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "docomment", - "version": "0.0.2", + "version": "0.0.3", "publisher": "k--kato", "engines": { "vscode": "^0.10.6" diff --git a/src/Domain/Lang/DocommentDomainCSharp.ts b/src/Domain/Lang/DocommentDomainCSharp.ts index 52726b2..97560d2 100644 --- a/src/Domain/Lang/DocommentDomainCSharp.ts +++ b/src/Domain/Lang/DocommentDomainCSharp.ts @@ -124,6 +124,21 @@ export class DocommentDomainCSharp extends DocommentDomain { return ''; } + return this.GeneSummary(code, paramNameList, hasReturn); + } + + /* @implements */ + public MoveCursorTo(docomment: string): void { + const curPosition = this._vsCodeApi.GetActivePosition(); + this._vsCodeApi.MoveSelection(curPosition.line + 1, curPosition.character + 2); + } + + + /*------------------------------------------------------------------------- + * Private Method + *-----------------------------------------------------------------------*/ + + private GeneSummary(code: string, paramNameList: Array, hasReturn: boolean): string { let docommentList: Array = new Array(); @@ -157,9 +172,4 @@ export class DocommentDomainCSharp extends DocommentDomain { return docomment; } - /* @implements */ - public MoveCursorTo(docomment: string): void { - const curPosition = this._vsCodeApi.GetActivePosition(); - this._vsCodeApi.MoveSelection(curPosition.line + 1, curPosition.character + 2); - } } diff --git a/src/SyntacticAnalysis/SyntacticAnalysisCSharp.ts b/src/SyntacticAnalysis/SyntacticAnalysisCSharp.ts index c4f15b9..2452ee2 100644 --- a/src/SyntacticAnalysis/SyntacticAnalysisCSharp.ts +++ b/src/SyntacticAnalysis/SyntacticAnalysisCSharp.ts @@ -52,7 +52,7 @@ export class SyntacticAnalysisCSharp { public static IsField(code: string): boolean { if (code === null) return false; - return code.match(/;[ \t]*$/) !== null; + return code.match(/[^()]+;[ \t]*$/) !== null; } public static IsMethod(code: string): boolean { diff --git a/test/TestData/X.cs b/test/TestData/X.cs new file mode 100644 index 0000000..ca98b70 --- /dev/null +++ b/test/TestData/X.cs @@ -0,0 +1,24 @@ +namespace N // "N:N" +{ + public unsafe class X // "T:N.X" + { + public X(){} // "M:N.X.#ctor" + public X(int i){} // "M:N.X.#ctor(System.Int32)" + public string q; // "F:N.X.q" + public const double PI = 3.14; // "F:N.X.PI" + public int f(){return 1;} // "M:N.X.f" + public int bb(string s, ref int y, void * z){return 1;} // "M:N.X.bb(System.String,System.Int32@,=System.Void*)" + public int gg(short[] array1, int[,] array){return 0;} // "M:N.X.gg(System.Int16[], System.Int32[0:,0:])" + public static X operator+(X x, X xx){return x;} // "M:N.X.op_Addition(N.X,N.X)" + public int prop {get{return 1;} set{}} // "P:N.X.prop" + public event D d; // "E:N.X.d" + public int this[string s]{get{return 1;}} // "P:N.X.Item(System.String)" + public class Nested{} // "T:N.X.Nested" + public delegate void D(int i); // "T:N.X.D" + public static explicit operator int(X x){return 1;} // "M:N.X.op_Explicit(N.X)~System.Int32" + public DbSet Directors { get; set; } + public List bb(string s, ref List y, void * z){return 1;} // "M:N.X.bb(System.String,System.Int32@,=System.Void*)" + int bb(string s, ref int y, void * z){return 1;} // "M:N.X.bb(System.String,System.Int32@,=System.Void*)" + int Generate(int level); + } +} diff --git a/test/TestData/project.json b/test/TestData/project.json new file mode 100644 index 0000000..e69de29