Skip to content

Commit

Permalink
Handle settings file for unsaved workspace (#2077)
Browse files Browse the repository at this point in the history
  • Loading branch information
EzioLi01 committed Dec 5, 2023
1 parent 7bdde98 commit e7d52fb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/extension/settingsHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,14 @@ export class SettingsHelper {
public static async getWorkspaceFileExcludeFolder(
settingsPath: string | undefined,
): Promise<any> {
const workspaceSettingsContent = settingsPath
? JSON.parse(stripJsonComments(fs.readFileSync(settingsPath, "utf-8")))
: null;
// Handle non-workspace project and untitled workspace
if (!settingsPath || !fs.existsSync(settingsPath)) {
return [];
}
// Get workspace settings
const workspaceSettingsContent = JSON.parse(
stripJsonComments(fs.readFileSync(settingsPath, "utf-8")),
);
if (workspaceSettingsContent) {
if (workspaceSettingsContent.settings) {
const exclude = workspaceSettingsContent.settings["react-native.workspace.exclude"];
Expand Down

0 comments on commit e7d52fb

Please sign in to comment.