Using removeComments from commandLineParser. This is more robust as it removes both single and multiline comments

This commit is contained in:
Jason Ramsay
2016-02-23 13:30:24 -08:00
parent 20511f8be1
commit 18883f9d32
2 changed files with 2 additions and 3 deletions

View File

@@ -21,8 +21,7 @@ namespace ts.JsTyping {
function tryParseJson(jsonPath: string, host: TypingResolutionHost): any {
if (host.fileExists(jsonPath)) {
try {
// Strip out single-line comments
const contents = host.readFile(jsonPath).replace(/^\s*\/\/(.*)$/gm, "");
const contents = removeComments(host.readFile(jsonPath));
return JSON.parse(contents);
}
catch (e) { }