Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Commit

Permalink
fix: parse .vscode/settings.json with json5
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Mar 1, 2020
1 parent 1be0c24 commit b3de3d3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion core/vscode_settings.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as path from "path";
import * as fs from "fs";

import json5 from "json5";

import { pathExistsSync } from "./util";

export type DenoPluginConfig = {
Expand All @@ -23,7 +25,7 @@ export function readConfigurationFromVscodeSettings(
const content = fs.readFileSync(vscodeSettingsFile, { encoding: "utf8" });

try {
const settings = JSON.parse(content);
const settings = json5.parse(content);

const isEnable = !!settings["deno.enable"];
const dts_file = settings["deno.dts_file"] || [];
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
"devDependencies": {
"@types/deep-equal": "1.0.1",
"@types/jest": "25.1.3",
"@types/json5": "^0.0.30",
"@types/node": "12.12.29",
"@types/which": "1.3.2",
"@typescript-eslint/eslint-plugin": "2.21.0",
Expand All @@ -167,6 +168,7 @@
},
"dependencies": {
"deepmerge": "^4.2.2",
"json5": "^2.1.1",
"typescript-deno-plugin": "./typescript-deno-plugin",
"vscode-nls-i18n": "^0.2.0"
}
Expand Down
4 changes: 3 additions & 1 deletion typescript-deno-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
},
"dependencies": {
"deep-equal": "^2.0.1",
"deepmerge": "^4.2.2"
"deepmerge": "^4.2.2",
"json5": "^2.1.1"
},
"devDependencies": {
"@types/deep-equal": "1.0.1",
"@types/json5": "^0.0.30",
"typescript": "3.8.3"
}
}

0 comments on commit b3de3d3

Please sign in to comment.