Repository: microsoft/terminal
File: src/cascadia/TerminalSettingsEditor/SettingContainer.cpp (C++)

Code before:
                    button.Visibility(Visibility::Collapsed);
                }
            }
        }
    }

    // Method Description:
    // - Helper function for generating the override message
    // Arguments:
    // - profile: the profile that defines the setting (aka SettingOverrideSource)
    // Return Value:
    // - text specifying where the setting was defined. If empty, we don't want to show the system.
    hstring SettingContainer::_GenerateOverrideMessage(const IInspectable& settingOrigin)
    {
        // We only get here if the user had an override in place.
        Model::OriginTag originTag{ Model::OriginTag::None };
        winrt::hstring source;

        if (const auto& profile{ settingOrigin.try_as<Model::Profile>() })
        {
            source = profile.Source();
            originTag = profile.Origin();
        }
        else if (const auto& appearanceConfig{ settingOrigin.try_as<Model::AppearanceConfig>() })
        {
            auto profile = appearanceConfig.SourceProfile();
            source = profile.Source();
            originTag = profile.Origin();
        }

        if constexpr (Feature_ShowProfileDefaultsInSettings::IsEnabled())
        {
            // EXPERIMENTAL FEATURE
            // We will display arrows for all origins, and informative tooltips for Fragments and Generated
            if (originTag == Model::OriginTag::Fragment || originTag == Model::OriginTag::Generated)
            {
                // from a fragment extension or generated profile
                return hstring{ fmt::format(std::wstring_view{ RS_(L"SettingContainer_OverrideMessageFragmentExtension") }, source) };
            }
            return RS_(L"SettingContainer_OverrideMessageBaseLayer");
        }

        // STABLE FEATURE
        // We will only display arrows and informative tooltips for Fragments
        if (originTag == Model::OriginTag::Fragment)
        {
            // from a fragment extension
            return hstring{ fmt::format(std::wstring_view{ RS_(L"SettingContainer_OverrideMessageFragmentExtension") }, source) };
        }
        return {}; // no tooltip
    }

Review comment (suggestion):
```suggestion
            const auto& profile = appearanceConfig.SourceProfile();
```

Code after:
                    button.Visibility(Visibility::Collapsed);
                }
            }
        }
    }

    // Method Description:
    // - Helper function for generating the override message
    // Arguments:
    // - profile: the profile that defines the setting (aka SettingOverrideSource)
    // Return Value:
    // - text specifying where the setting was defined. If empty, we don't want to show the system.
    hstring SettingContainer::_GenerateOverrideMessage(const IInspectable& settingOrigin)
    {
        // We only get here if the user had an override in place.
        Model::OriginTag originTag{ Model::OriginTag::None };
        winrt::hstring source;

        if (const auto& profile{ settingOrigin.try_as<Model::Profile>() })
        {
            source = profile.Source();
            originTag = profile.Origin();
        }
        else if (const auto& appearanceConfig{ settingOrigin.try_as<Model::AppearanceConfig>() })
        {
            const auto profile = appearanceConfig.SourceProfile();
            source = profile.Source();
            originTag = profile.Origin();
        }

        if constexpr (Feature_ShowProfileDefaultsInSettings::IsEnabled())
        {
            // EXPERIMENTAL FEATURE
            // We will display arrows for all origins, and informative tooltips for Fragments and Generated
            if (originTag == Model::OriginTag::Fragment || originTag == Model::OriginTag::Generated)
            {
                // from a fragment extension or generated profile
                return hstring{ fmt::format(std::wstring_view{ RS_(L"SettingContainer_OverrideMessageFragmentExtension") }, source) };
            }
            return RS_(L"SettingContainer_OverrideMessageBaseLayer");
        }

        // STABLE FEATURE
        // We will only display arrows and informative tooltips for Fragments
        if (originTag == Model::OriginTag::Fragment)
        {
            // from a fragment extension
            return hstring{ fmt::format(std::wstring_view{ RS_(L"SettingContainer_OverrideMessageFragmentExtension") }, source) };
        }
        return {}; // no tooltip
    }