Developer Portal Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    OES/CPS change request

    MarvinW
    Established Member

    OES/CPS change request

    Hello, dear Nexeed Developer Team,

    today I encountered a small nuissance that can be easily fixed.

    Problem: In my source code control, I have trouble seeing what changed in an enum.

    MarvinW_0-1635143517536.png

    Reason: The length of the longest item changed. This lead to a change of the comma position at the end of each line, making the code file comparison tool think that each line was changed. So the actual semantic change I made (added or removed items) are not obvious at all.

    Solution: Don't align all commas, simply put them at the end of the text (this is also how a normal human would write an enum by hand). To make this happen, the standard export templates of enum types needs to be changed in OES.

    I went ahead and modify the otd file accordingly:

    <% // --- ENUMERATION %>
    <* Enumeration name="<%=@this.Name%>" path="<%=@this.Path%>" Overwrite="True" Comment="<%=@this.Comment%>" Pragma="attribute 'qualified_only'" EnumType="<%= @this.TypeName %>"*>
    TYPE <%=@this.Name%> :
    (
    <% for (int counter = 0; counter < @this.EnumItems.Count; counter++){%>
    <% if (!string.IsNullOrEmpty(@this.EnumItems[counter].Comment)){%>
      /// <%=@this.EnumItems[counter].Comment%>
    <% }%>
    <% if (!string.IsNullOrEmpty(@this.EnumItems[counter].ValueString)){%>
      <%=@this.EnumItems[counter].Name%><% *luIndex* %> := <%=@this.EnumItems[counter].ValueString%><%= counter < @this.EnumItems.Count-1 ? "," : string.Empty %>
    <% } else { %>
      <%=@this.EnumItems[counter].Name%><%= counter < @this.EnumItems.Count-1 ? "," : string.Empty %>
    <% }%>
    <% }%>
    ) <%= @this.TypeName %>;
    END_TYPE

    (I took liberty to also remove some useless spaces at the end of the comment lines).

    Please consider using this as the new template for the next OES/CPS release.

    1 REPLY 1
    nexidator
    Community Moderator

    Re: OES/CPS change request

    Thanks for your input! This would even be an argument against aligning any code at all. We still prefer aligning assignments for readability reasons. But you are right, aligning the commas does not make much sense. We will change this in Control plus Studio 5.3, but not in any compatible OES updates.

    BTW: The blanks at the end of the comment have already been removed in OES 4.11 and CpStudio 5.0.

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist