From f74d764ae05dbe323da580d3bee4dcb4db04c542 Mon Sep 17 00:00:00 2001 From: k--kato Date: Tue, 31 Jan 2017 00:50:03 +0900 Subject: [PATCH] Fixed #32 Parameters are not returned --- CHANGELOG.md | 4 ++++ package.json | 2 +- src/SyntacticAnalysis/SyntacticAnalysisCSharp.ts | 3 ++- test/TestData/X.cs | 4 ++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6054ee1..42d2b33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 0.0.13 (January 31, 2017) + +* bug fix - Parameters are not returned . See [#32](https://github.com/k--kato/vscode-docomment/issues/32). + ## 0.0.12 (January 21, 2017) * bug fix - Output document puts cursor in wrong place. See [#26](https://github.com/k--kato/vscode-docomment/issues/26). diff --git a/package.json b/package.json index d8aa3d8..3c12d3e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "docomment", - "version": "0.0.12", + "version": "0.0.13", "publisher": "k--kato", "engines": { "vscode": "^1.8.0" diff --git a/src/SyntacticAnalysis/SyntacticAnalysisCSharp.ts b/src/SyntacticAnalysis/SyntacticAnalysisCSharp.ts index 25646ac..5d93cf5 100644 --- a/src/SyntacticAnalysis/SyntacticAnalysisCSharp.ts +++ b/src/SyntacticAnalysis/SyntacticAnalysisCSharp.ts @@ -90,7 +90,8 @@ export class SyntacticAnalysisCSharp { public static GetMethodParamNameList(code: string): Array { if (code === null) return null; - const params: RegExpMatchArray = code.match(/[\w\S]\s+[\w\S]+\s*\(([^)]*)\)/); + const removedAttrCode: string = code.replace(/^\s*\[.+?\]/, ''); // FIXME: + const params: RegExpMatchArray = removedAttrCode.match(/[\w\S]\s+[\w\S]+\s*\(([^)]*)\)/); const isMatched = (params === null || params.length !== 2); if (isMatched) return null; diff --git a/test/TestData/X.cs b/test/TestData/X.cs index 0ff0a1c..22e7be2 100644 --- a/test/TestData/X.cs +++ b/test/TestData/X.cs @@ -34,5 +34,9 @@ public void Save(string data, Action onComplete = null public Collection Filter(Func queryFirst, Func querySecond) { return null; } public void Test(string options) : base(options) { } public void Testing2(string String1, string String2, string String3) : base() { } + [HttpGet] + [Route("{userId}")] + public object Get(int userId) { return null; } + public object Get(int[] userId, string[] val) { return null; } } }