in src/extension/debuggingConfiguration/reactNativeDebugDynamicConfigProvider.ts [22:107]
public async provideDebugConfigurations(
folder: vscode.WorkspaceFolder | undefined,
token?: vscode.CancellationToken, // eslint-disable-line @typescript-eslint/no-unused-vars
): Promise<vscode.DebugConfiguration[]> {
const debugConfigurationsToShow = Object.assign({}, debugConfigurations);
if (folder) {
const rootPath = folder.uri.fsPath;
const projectRootPath = SettingsHelper.getReactNativeProjectRoot(rootPath);
const versions =
await ProjectVersionHelper.tryToGetRNSemverValidVersionsFromProjectPackage(
projectRootPath,
ProjectVersionHelper.generateAllAdditionalPackages(),
projectRootPath,
);
let macOSHermesEnabled = false;
let windowsHermesEnabled = false;
const androidHermesEnabled = ReactNativeProjectHelper.isAndroidHermesEnabled(rootPath);
const iOSHermesEnabled = ReactNativeProjectHelper.isIOSHermesEnabled(rootPath);
if (ProjectVersionHelper.isVersionError(versions.reactNativeWindowsVersion)) {
delete debugConfigurationsToShow[DEBUG_CONFIGURATION_NAMES.DEBUG_WINDOWS];
delete debugConfigurationsToShow[
DEBUG_CONFIGURATION_NAMES.DEBUG_WINDOWS_HERMES_EXPERIMENTAL
];
} else {
windowsHermesEnabled = ReactNativeProjectHelper.isWindowsHermesEnabled(rootPath);
if (!windowsHermesEnabled) {
delete debugConfigurationsToShow[
DEBUG_CONFIGURATION_NAMES.DEBUG_WINDOWS_HERMES_EXPERIMENTAL
];
}
}
if (ProjectVersionHelper.isVersionError(versions.reactNativeMacOSVersion)) {
delete debugConfigurationsToShow[DEBUG_CONFIGURATION_NAMES.DEBUG_MACOS];
delete debugConfigurationsToShow[
DEBUG_CONFIGURATION_NAMES.DEBUG_MACOS_HERMES_EXPERIMENTAL
];
} else {
macOSHermesEnabled = ReactNativeProjectHelper.isMacOSHermesEnabled(rootPath);
if (!macOSHermesEnabled) {
delete debugConfigurationsToShow[
DEBUG_CONFIGURATION_NAMES.DEBUG_MACOS_HERMES_EXPERIMENTAL
];
}
}
if (!androidHermesEnabled) {
delete debugConfigurationsToShow[
DEBUG_CONFIGURATION_NAMES.DEBUG_ANDROID_HERMES_EXPERIMENTAL
];
delete debugConfigurationsToShow[
DEBUG_CONFIGURATION_NAMES.RUN_ANDROID_HERMES_EXPERIMENTAL
];
}
if (!iOSHermesEnabled) {
delete debugConfigurationsToShow[
DEBUG_CONFIGURATION_NAMES.DEBUG_IOS_HERMES_EXPERIMENTAL
];
delete debugConfigurationsToShow[
DEBUG_CONFIGURATION_NAMES.RUN_IOS_HERMES_EXPERIMENTAL
];
}
if (
!androidHermesEnabled &&
!iOSHermesEnabled &&
!macOSHermesEnabled &&
!windowsHermesEnabled
) {
delete debugConfigurationsToShow[
DEBUG_CONFIGURATION_NAMES.ATTACH_TO_HERMES_APPLICATION_EXPERIMENTAL
];
}
}
const debugConfigurationsToShowList = Object.values(debugConfigurationsToShow);
debugConfigurationsToShowList.forEach(config => {
config.isDynamic = true;
});
return debugConfigurationsToShowList;
}