Skip to content

Commit

Permalink
Handle comment line in workspace settings file (#2071)
Browse files Browse the repository at this point in the history
Co-authored-by: benjaminbi <42724242+benjaminbi@users.noreply.github.com>
  • Loading branch information
EzioLi01 and benjaminbi committed Nov 20, 2023
1 parent f97d6e3 commit 91e52f2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/extension/settingsHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Packager } from "../common/packager";
import { SystemColorTheme } from "../common/editorColorThemesHelper";
import { LogLevel } from "./log/LogHelper";
import { PackagerStatusIndicator } from "./packagerStatusIndicator";
import stripJsonComments = require("strip-json-comments");

export class SettingsHelper {
/**
Expand Down Expand Up @@ -210,7 +211,7 @@ export class SettingsHelper {
settingsPath: string | undefined,
): Promise<any> {
const workspaceSettingsContent = settingsPath
? JSON.parse(fs.readFileSync(settingsPath, "utf-8"))
? JSON.parse(stripJsonComments(fs.readFileSync(settingsPath, "utf-8")))
: null;
if (workspaceSettingsContent) {
if (workspaceSettingsContent.settings) {
Expand Down

0 comments on commit 91e52f2

Please sign in to comment.