Skip to content

Commit 14a24ab

Browse files
authored
Keep file contents when copying class definition if "Class" line not found (intersystems-community#1267)
1 parent 231bcfb commit 14a24ab

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/providers/FileSystemProvider/FileSystemProvider.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,19 @@ export function generateFileContent(
4545
// Replace that with one to match fileName.
4646
while (sourceLines.length > 0) {
4747
const nextLine = sourceLines.shift();
48-
if (nextLine.startsWith("Class ")) {
48+
if (nextLine.toLowerCase().startsWith("class ")) {
4949
const classLine = nextLine.split(" ");
50+
classLine[0] = "Class";
5051
classLine[1] = className;
5152
content.push(...preamble, classLine.join(" "), ...sourceLines);
5253
break;
5354
}
5455
preamble.push(nextLine);
5556
}
57+
if (!content.length) {
58+
// Transfer sourceLines verbatim in cases where no class header line is found
59+
content.push(...preamble);
60+
}
5661
}
5762
} else {
5863
content = [`Class ${className} Extends %RegisteredObject`, "{", "}"];

0 commit comments

Comments
 (0)