Skip to content

Commit c2f8ae1

Browse files
author
Keisuke KATO
committed
Merge pull request #7 from k--kato/fix/#6
fixed #6
2 parents a11e798 + 5c84873 commit c2f8ae1

File tree

5 files changed

+35
-11
lines changed

5 files changed

+35
-11
lines changed

.vscode/launch.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
1111
"stopOnEntry": false,
1212
"sourceMaps": true,
13-
"outDir": "out/src"
13+
"outDir": "${workspaceRoot}/out/src"
1414
},
1515
{
1616
"name": "Launch Tests",
@@ -20,7 +20,7 @@
2020
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ],
2121
"stopOnEntry": false,
2222
"sourceMaps": true,
23-
"outDir": "out/test"
23+
"outDir": "${workspaceRoot}/out/test"
2424
}
2525
]
2626
}

package.json

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "docomment",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"publisher": "k--kato",
55
"engines": {
6-
"vscode": "^0.10.6"
6+
"vscode": "^0.10.x"
77
},
88
"displayName": "C# XML Documentation Comments",
99
"description": "Generate C# XML documentation comments for ///",
@@ -34,13 +34,13 @@
3434
"dependencies": {
3535
},
3636
"devDependencies": {
37-
"typescript": "^1.7.5",
38-
"vscode": "^0.10.x",
39-
"tslint": "^3.3.0",
37+
"typescript": "^1.8.9",
38+
"vscode": "^0.11.10",
39+
"tslint": "^3.6.0",
4040
"istanbul": "^0.4.2",
41-
"coveralls": "^2.11.6",
41+
"coveralls": "^2.11.9",
4242
"mocha": "^2.4.5",
43-
"mocha-lcov-reporter": "^1.0.0"
43+
"mocha-lcov-reporter": "^1.2.0"
4444
},
4545
"extensionDependencies": [
4646
],
@@ -51,7 +51,8 @@
5151
"watch": "node ./node_modules/vscode/bin/compile -watch -p ./",
5252
"test": "node ./node_modules/vscode/bin/test",
5353
"coverage_travis": "./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- -R spec --ui tdd ./out/test/**/*.js",
54-
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha -- -R spec --ui tdd ./out/test/**/*.js"
54+
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha -- -R spec --ui tdd ./out/test/**/*.js",
55+
"postinstall": "node ./node_modules/vscode/bin/install"
5556
},
5657
"icon": "images/docomment.png",
5758
"license": "MIT",

src/SyntacticAnalysis/SyntacticAnalysisCSharp.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ export class SyntacticAnalysisCSharp {
7474

7575
let paramName: Array<string> = new Array<string>();
7676
params[1].split(',').forEach(param => {
77-
const name: RegExpMatchArray = param.match(/\s(\w+)$/);
77+
const hasOptionaParam: boolean = param.match(/\S+\s+\S+\s*=/) !== null;
78+
const name: RegExpMatchArray = (hasOptionaParam)
79+
? param.match(/\S+\s+(\S+)\s*=.*/)
80+
: param.match(/(\S+)\s*$/);
7881
if (name !== null && name.length === 2) {
7982
paramName.push(name[1]);
8083
}

test/SyntacticAnalysis/SyntacticAnalysisCSharp.test.ts

+19
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,23 @@ suite('SyntacticAnalysis.SyntacticAnalysisCSharp.IsClass Tests', () => {
189189
assert.equal(actual, true);
190190
});
191191

192+
test(`
193+
Category: Black-box testing
194+
Class : SyntacticAnalysis.SyntacticAnalysisCSharp
195+
Method : GetMethodParamNameList
196+
STATE : -
197+
IN : ' public void Save(string data, Action<AchievementSavedResponse> onComplete = null) {'
198+
OUT : [0]='data', [1]='onComplete'
199+
`, () => {
200+
// arrange
201+
const code = ' public void Save(string data, Action<AchievementSavedResponse> onComplete = null) {';
202+
203+
// act
204+
const actual: Array<string> = SyntacticAnalysisCSharp.GetMethodParamNameList(code);
205+
206+
// assert
207+
assert.equal(actual[0], 'data');
208+
assert.equal(actual[1], 'onComplete');
209+
});
210+
192211
});

test/TestData/X.cs

+1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ public class Nested{} // "T:N.X.Nested"
2020
public List<int> bb<int>(string s, ref List<int> y, void * z){return 1;} // "M:N.X.bb(System.String,System.Int32@,=System.Void*)"
2121
int bb(string s, ref int y, void * z){return 1;} // "M:N.X.bb(System.String,System.Int32@,=System.Void*)"
2222
int Generate(int level);
23+
public void Save(string data, Action<AchievementSavedResponse> onComplete = null);
2324
}
2425
}

0 commit comments

Comments
 (0)