From e5bbb476800c9bf24820701ec9252153ba07cf6a Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Mon, 18 Nov 2019 02:37:18 +0100 Subject: Readding jsonc parser because of https://github.com/rust-analyzer/rust-analyzer/pull/2061\#discussion_r344783715 --- editors/code/package-lock.json | 5 +++++ editors/code/package.json | 3 ++- editors/code/src/scopes.ts | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'editors/code') diff --git a/editors/code/package-lock.json b/editors/code/package-lock.json index 9c55c257f..a41497a23 100644 --- a/editors/code/package-lock.json +++ b/editors/code/package-lock.json @@ -720,6 +720,11 @@ "esprima": "^4.0.0" } }, + "jsonc-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.2.0.tgz", + "integrity": "sha512-4fLQxW1j/5fWj6p78vAlAafoCKtuBm6ghv+Ij5W2DrDx0qE+ZdEl2c6Ko1mgJNF5ftX1iEWQQ4Ap7+3GlhjkOA==" + }, "lcid": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", diff --git a/editors/code/package.json b/editors/code/package.json index 5c5be34db..fbf675d46 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -32,7 +32,8 @@ }, "dependencies": { "seedrandom": "^3.0.1", - "vscode-languageclient": "^5.3.0-next.4" + "vscode-languageclient": "^5.3.0-next.4", + "jsonc-parser": "^2.1.0" }, "devDependencies": { "@types/glob": "^7.1.1", diff --git a/editors/code/src/scopes.ts b/editors/code/src/scopes.ts index 98099872c..8f288d761 100644 --- a/editors/code/src/scopes.ts +++ b/editors/code/src/scopes.ts @@ -1,4 +1,5 @@ import * as fs from 'fs'; +import * as jsonc from 'jsonc-parser'; import * as path from 'path'; import * as vscode from 'vscode'; @@ -140,7 +141,6 @@ function readFileText(filePath: string): string { return fs.readFileSync(filePath, 'utf8'); } -// Might need to replace with JSONC if a theme contains comments. function parseJSON(content: string): any { - return JSON.parse(content); + return jsonc.parse(content); } -- cgit v1.2.3