This is a migrated thread and some comments may be shown as answers.

Introduce constant issue

3 Answers 56 Views
Refactorings
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Andrew
Top achievements
Rank 1
Veteran
Iron
Andrew asked on 06 Jan 2014, 08:35 PM

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

3 Answers, 1 is accepted

Sort by
0
Zdravko
Telerik team
answered on 08 Jan 2014, 10:31 AM
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.
0
Andrew
Top achievements
Rank 1
Veteran
Iron
answered on 08 Jan 2014, 03:19 PM

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?

0
Zdravko
Telerik team
answered on 09 Jan 2014, 10:18 AM
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.
Tags
Refactorings
Asked by
Andrew
Top achievements
Rank 1
Veteran
Iron
Answers by
Zdravko
Telerik team
Andrew
Top achievements
Rank 1
Veteran
Iron
Share this question
or