From e44767095926723c77579927e98c35cca6063d9b Mon Sep 17 00:00:00 2001 From: k--kato Date: Fri, 2 Dec 2016 02:11:57 +0900 Subject: [PATCH] fixed Adds extra param for `Func` #19 --- CHANGELOG.md | 19 +++++++++++++++++++ .../SyntacticAnalysisCSharp.ts | 17 +++++++++++++---- test/TestData/X.cs | 2 ++ 3 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c0f65e1 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,19 @@ +# Change Log + +## 0.0.8 (December 2, 2016) + +* bug fix - Adds extra param for `Func`. See [#19](https://github.com/k--kato/vscode-docomment/issues/19). + +## 0.0.7 (July 11, 2016) + +## 0.0.6 (Jun 24, 2016) + +## 0.0.5 (April 2, 2016) + +## 0.0.4 (February 7, 2016) + +## 0.0.3 (January 24, 2016) + +## 0.0.2 (January 14, 2016) + +## 0.0.1 (January 4, 2016) diff --git a/src/SyntacticAnalysis/SyntacticAnalysisCSharp.ts b/src/SyntacticAnalysis/SyntacticAnalysisCSharp.ts index 27cccf4..a504175 100644 --- a/src/SyntacticAnalysis/SyntacticAnalysisCSharp.ts +++ b/src/SyntacticAnalysis/SyntacticAnalysisCSharp.ts @@ -96,10 +96,19 @@ export class SyntacticAnalysisCSharp { let paramName: Array = new Array(); params[1].split(',').forEach(param => { - const hasOptionaParam: boolean = param.match(/\S+\s+\S+\s*=/) !== null; - const name: RegExpMatchArray = (hasOptionaParam) - ? param.match(/\S+\s+(\S+)\s*=.*/) - : param.match(/(\S+)\s*$/); + const hasOptionalParam: boolean = param.match(/\S+\s+\S+\s*=/) !== null; + const hasGenericParam: boolean = param.match(/[<]/) !== null; + const hasTypeInfo: boolean = param.match(/[\w\W]+\s+[\w\W]+/) !== null; + let name: RegExpMatchArray = null; + if (hasOptionalParam) { + name = param.match(/\S+\s+(\S+)\s*=.*/) + } else if (hasGenericParam) { + name = null; // SKIP + } else if (!hasTypeInfo) { + name = null; // SKIP + } else { + name = param.match(/(\S+)\s*$/); + } if (name !== null && name.length === 2) { paramName.push(name[1]); } diff --git a/test/TestData/X.cs b/test/TestData/X.cs index 71eb838..b0b4626 100644 --- a/test/TestData/X.cs +++ b/test/TestData/X.cs @@ -27,5 +27,7 @@ public class Nested{} // "T:N.X.Nested" [Route("{time}/{location}")] [HttpGet] public async Task GetInfoForTime(string location, double time) + public Collection Filter(Func query) { } + public Collection Filter(Func queryFirst, Func querySecond) { } } }