Author Topic: Additional C/C++/C#/... refactorings  (Read 3073 times)

jwiede

  • Senior Community Member
  • Posts: 112
  • Hero Points: 12
Additional C/C++/C#/... refactorings
« on: April 02, 2012, 06:17:11 PM »
Additional C/C++/C#/... refactorings I'd like to see:
  • "Globally replace type":  Globally replace usage of a given type with another type.  For example, replace all uses of "unsigned int" with "UINT32".

  • "Change method/func return type"/"Change method/func signature":  For a given function, modify proto & impl, and cite all references in output list (for user to manually fix up references).
The first seems simple to do with find-replace but isn't really, as an example of the issue consider trying to use find-replace to replace "unsigned" types without modifying any other unsigned types.  The replacement needs to be done after tokenization/parsing to work effectively (and not run into ambiguity problems).

If the second is already supported, I can't seem to find it (and am a bit surprised by that).  If we're able to modify the other parts of method/func signatures, why not the return type as well?  In any case, it is needed for effective refactoring.

pmwhite

  • Community Member
  • Posts: 98
  • Hero Points: 7
Re: Additional C/C++/C#/... refactorings
« Reply #1 on: April 05, 2012, 10:56:15 PM »
2) When I am in a header file, right-click on a class definition, and choose Quick Refactoring -> Override Method, give me a choice whether to create declarations or definitions in the header file. Right now SlickEdit assumes that I want inline definitions, whereas my project has definitions in a separate source file.

You've implemented this in v17! You're awesome!

davehohl

  • Senior Community Member
  • Posts: 271
  • Hero Points: 27
Re: Additional C/C++/C#/... refactorings
« Reply #2 on: June 03, 2015, 06:16:25 PM »
When you hover over a symbol that is #defined, SE will pop-up a little box showing the value of the symbol. Since many recommend the use of const variables instead of #defines for C++, it would be nice if SE showed the value assigned to a const variable in the pop-up in addition to the other info already displayed.

jwiede

  • Senior Community Member
  • Posts: 112
  • Hero Points: 12
Re: Additional C/C++/C#/... refactorings
« Reply #3 on: June 11, 2015, 08:27:08 PM »
When you hover over a symbol that is #defined, SE will pop-up a little box showing the value of the symbol. Since many recommend the use of const variables instead of #defines for C++, it would be nice if SE showed the value assigned to a const variable in the pop-up in addition to the other info already displayed.
+1 on this.  Offering a C/C++ refactoring to convert value #defines into consts (with choice of global, class-local, etc) would also be nice, and I don't believe exists now (if it does, I've missed it somehow).

jwiede

  • Senior Community Member
  • Posts: 112
  • Hero Points: 12
Re: Additional C/C++/C#/... refactorings
« Reply #4 on: August 21, 2017, 02:29:13 AM »
Additional C/C++/C#/... refactorings I'd like to see:
  • "Globally replace type":  Globally replace usage of a given type with another type.  For example, replace all uses of "unsigned int" with "UINT32".

  • "Change method/func return type"/"Change method/func signature":  For a given function, modify proto & impl, and cite all references in output list (for user to manually fix up references).
The first seems simple to do with find-replace but isn't really, as an example of the issue consider trying to use find-replace to replace "unsigned" types without modifying any other unsigned types.  The replacement needs to be done after tokenization/parsing to work effectively (and not run into ambiguity problems).

If the second is already supported, I can't seem to find it (and am a bit surprised by that).  If we're able to modify the other parts of method/func signatures, why not the return type as well?  In any case, it is needed for effective refactoring.

  • Offering a C/C++ refactoring to convert value #defines into consts (with choice of global, class-local, etc) would also be nice, and I don't believe exists now (if it does, I've missed it somehow).

Any word whether any of the above bulleted requests made it into V22 (or prior, though don't believe they did)?

jwiede

  • Senior Community Member
  • Posts: 112
  • Hero Points: 12
Re: Additional C/C++/C#/... refactorings
« Reply #5 on: August 29, 2017, 01:23:51 AM »
Additional C/C++/C#/... refactorings I'd like to see:
  • "Globally replace type":  Globally replace usage of a given type with another type.  For example, replace all uses of "unsigned int" with "UINT32".

  • "Change method/func return type"/"Change method/func signature":  For a given function, modify proto & impl, and cite all references in output list (for user to manually fix up references).
The first seems simple to do with find-replace but isn't really, as an example of the issue consider trying to use find-replace to replace "unsigned" types without modifying any other unsigned types.  The replacement needs to be done after tokenization/parsing to work effectively (and not run into ambiguity problems).

If the second is already supported, I can't seem to find it (and am a bit surprised by that).  If we're able to modify the other parts of method/func signatures, why not the return type as well?  In any case, it is needed for effective refactoring.

  • Offering a C/C++ refactoring to convert value #defines into consts (with choice of global, class-local, etc) would also be nice, and I don't believe exists now (if it does, I've missed it somehow).

Any word whether any of the above bulleted requests made it into V22 (or prior, though don't believe they did)?

Anyone?  Above in V22?