Skip to content

Commit

Permalink
Add support to ignore comment lines that start with #
Browse files Browse the repository at this point in the history
  • Loading branch information
drorm committed Apr 9, 2023
1 parent a8cdfa7 commit c03094a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/importFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { Utils } from "./utils.js";
/**
* Handle #import statements.
* Give a string, look for "#import" or "#diff" statements.
* #import file: actls like #import or #include file, by replacing the statement with the contents of a file
* #import file: acts like #import or #include file, by replacing the statement with the contents of a file
* '#' in the beginning of a line is a comment
* #diff does the same but also provides a hint that the result of the request, will need to go into this file
*/
export function importFiles(content: string): [boolean, string, string[]] {
Expand Down Expand Up @@ -48,7 +49,12 @@ export function importFiles(content: string): [boolean, string, string[]] {
return [false, `#import file ${filePath} was not found`, toDiffFiles];
}
} else {
// If the line is not an #import or #diff statement, add it to the modified lines list as is
// Check if the line is a comment
if (line.trim().startsWith("#")) {
// If it is, ignore the line and continue with the next line
continue;
}
// If the line is not an #import or #diff or a comment, add it to the modified lines list as is
modifiedLines.push(line);
}
}
Expand Down

0 comments on commit c03094a

Please sign in to comment.