Skip to content
This repository has been archived by the owner on Jul 18, 2022. It is now read-only.

Commit

Permalink
Fixing #8 - Changing jsonc parser so that it can handle trailing commas
Browse files Browse the repository at this point in the history
This is the same parser that's used internally by vscode
  • Loading branch information
aaronpowell committed Jul 19, 2019
1 parent 84184f6 commit 6159c21
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 60 deletions.
64 changes: 7 additions & 57 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
},
"dependencies": {
"fs-extra": "^8.0.1",
"jsonc": "^2.0.0",
"jsonc-parser": "^2.1.0",
"vsls": "^0.3.1291"
}
}
4 changes: 2 additions & 2 deletions src/settingsHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as vscode from "vscode";
import * as os from "os";
import * as path from "path";
import { Settings } from "./services/config";
import { jsonc } from "jsonc";
import * as jsonc from "jsonc-parser";

export enum OsType {
Windows = 1,
Expand Down Expand Up @@ -124,7 +124,7 @@ export default class SettingsHelper {

let newSettings = Object.assign({}, existingSettings, update);

let settingsAsJson = jsonc.stringify(newSettings, { space: 4 });
let settingsAsJson = JSON.stringify(newSettings, null, 4);

await fs.writeFile(this.getSettingsPath(), settingsAsJson, {
encoding: "utf8"
Expand Down

0 comments on commit 6159c21

Please # to comment.