Skip to content

Commit eddb4ac

Browse files
committed
Ignore xml comments
1 parent 0b51df4 commit eddb4ac

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "ky-generator",
33
"displayName": "KY-Generator",
44
"description": "Visual Studio Code Extension for KY.Generator",
5-
"version": "1.0.3",
5+
"version": "1.0.4",
66
"publisher": "KY-Programming",
77
"icon": "images/128.png",
88
"repository": "https://github.com/KY-Programming/generator-vs-code",

src/extension.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,17 @@ export function activate(context: vscode.ExtensionContext) {
4848
else {
4949
const start = content.indexOf('<Generator>') + 11;
5050
const end = content.indexOf('</Generator>');
51-
const generatorNode = content.substring(start, end);
51+
let generatorNode = content.substring(start, end);
52+
while (true) {
53+
const commentStart = generatorNode.indexOf('<!--');
54+
const commentEnd = generatorNode.indexOf('-->');
55+
if (commentStart >= 0) {
56+
generatorNode = generatorNode.substring(0, commentStart) + generatorNode.substring(commentEnd + 3);
57+
}
58+
else {
59+
break;
60+
}
61+
}
5262
const connectionStart = generatorNode.indexOf('<Connection>') + 12;
5363
const connectionEnd = generatorNode.indexOf('</Connection>');
5464
url = generatorNode.substring(connectionStart, connectionEnd).trim();
@@ -86,7 +96,9 @@ export function activate(context: vscode.ExtensionContext) {
8696
return Promise.all(promises).then(() => filePaths.length);
8797
})
8898
.then((count: number) => {
89-
vscode.window.showInformationMessage(count + ' files generated');
99+
if (count > 0) {
100+
vscode.window.showInformationMessage(count + ' files generated');
101+
}
90102
})
91103
.catch((error: Error) => {
92104
vscode.window.showErrorMessage('Can not reach the generator server #231d\r\n' + error);

0 commit comments

Comments
 (0)