in src/debugger/debugSessionBase.ts [121:174]
protected async initializeSettings(args: any): Promise<void> {
if (!this.isSettingsInitialized) {
let chromeDebugCoreLogs = getLoggingDirectory();
if (chromeDebugCoreLogs) {
chromeDebugCoreLogs = path.join(chromeDebugCoreLogs, "DebugSessionLogs.txt");
}
let logLevel: string = args.trace;
if (logLevel) {
logLevel = logLevel.replace(logLevel[0], logLevel[0].toUpperCase());
logger.setup(Logger.LogLevel[logLevel], chromeDebugCoreLogs || false);
this.cdpProxyLogLevel =
LogLevel[logLevel] === LogLevel.Verbose ? LogLevel.Custom : LogLevel.None;
} else {
logger.setup(Logger.LogLevel.Log, chromeDebugCoreLogs || false);
this.cdpProxyLogLevel =
LogHelper.LOG_LEVEL === LogLevel.Trace ? LogLevel.Custom : LogLevel.None;
}
if (typeof args.sourceMaps !== "boolean") {
args.sourceMaps = true;
}
if (typeof args.enableDebug !== "boolean") {
args.enableDebug = true;
}
// Now there is a problem with processing time of 'createFromSourceMap' function of js-debug
// So we disable this functionality by default https://github.com/microsoft/vscode-js-debug/issues/1033
if (typeof args.sourceMapRenames !== "boolean") {
args.sourceMapRenames = false;
}
const projectRootPath = SettingsHelper.getReactNativeProjectRoot(args.cwd);
const isReactProject = await ReactNativeProjectHelper.isReactNativeProject(
projectRootPath,
);
if (!isReactProject) {
throw ErrorHelper.getInternalError(InternalErrorCode.NotInReactNativeFolderError);
}
const appLauncher = await AppLauncher.getOrCreateAppLauncherByProjectRootPath(
projectRootPath,
);
this.appLauncher = appLauncher;
this.projectRootPath = projectRootPath;
this.isSettingsInitialized = true;
this.appLauncher.getOrUpdateNodeModulesRoot(true);
if (this.session.workspaceFolder) {
this.appLauncher.updateDebugConfigurationRoot(
this.session.workspaceFolder.uri.fsPath,
);
}
}
}