Introduce constant issue

4 posts, 0 answers
  1. Andrew
    Andrew avatar
    125 posts
    Member since:
    Sep 2008

    Posted 06 Jan 2014 Link to this post

    I am using the Introduce Constant feature from the refactoring tool. I have set a prefix of 'CONST_' and a rule of UPPER_UNDERSCORE

    but ever time I use the constant tool I always get 'CONST_S' is this a bug or  am I doing something wrong.

    also and I assign this to key combo?

    Thanks,

    Andrew Day

  2. Zdravko
    Admin
    Zdravko avatar
    657 posts

    Posted 08 Jan 2014 Link to this post

    Hi Andrew,

    Thanks for contacting us.
    When executed the "Introduce constant" command generate a constant field with default name "S" according to default naming convention settings which are PascalCase by default.
    When you change the rule to Upper_Underscore the generated name is still 'S', but because of the added prefix "CONST_" the final name becomes CONST_S which is expected.
    You have to rename the field to desired for you name before pressing Enter key to bring the command to a conclusion.
    Thanks.

    Regards,
    Zdravko
    Telerik
    Share what you think about JustCode with us, so we can help you even better! You can use the built-in feedback tool inside JustCode, our forum, or our JustCode feedback portal.
  3. DevCraft banner
  4. Andrew
    Andrew avatar
    125 posts
    Member since:
    Sep 2008

    Posted 08 Jan 2014 Link to this post

    ok, thanks

    Is there any chance to have an option in future versions that instead of using "S" as default is uses the text that you want to make into a constant with all rules applied.

    so in my case "Blue Car" is the text I want to make into a constant. when I apply the constant function to the text is will default to CONST_BLUE_CAR.

    also can I assign the constant function to a key combo?

  5. Zdravko
    Admin
    Zdravko avatar
    657 posts

    Posted 09 Jan 2014 Link to this post

    Hi Andrew,

    Thanks for the reply.
    You can set keyboard combination for the command as shown in this demo. Beware of replacing some shortcut already valuable to you.

    Regarding the name of the field, I will make an item in our product backlog and we will reconsider it within the team.
    Thanks.

    Regards,
    Zdravko
    Telerik
    Share what you think about JustCode with us, so we can help you even better! You can use the built-in feedback tool inside JustCode, our forum, or our JustCode feedback portal.
Back to Top