Author Topic: Parameter name comments  (Read 901 times)

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3435
  • Hero Points: 465
Parameter name comments
« on: June 05, 2020, 05:02:39 pm »
As 24.0.2, SlickEdit's auto-list compatible parameters feature will offer to insert the parameter name from the function prototype in a comment (for C-like languages) along with other compatible arguments.

For example:
Code: [Select]
void SomeFunction(bool doSomethingWild=true, bool doSomethingBoring=false);
void AnotherFunction(bool yesno)
{
     SomeFunction(      );
                   // ^ Press Alt+Comma Here
}

In the above case, you will see completions like this (you may have to hit Alt+Comma twice if you have auto-list compatible parameters turned off):
  • /*doSomethingWild*/
  • /*doSomethingWild*/false
  • /*doSomethingWild*/true
  • false
  • true
  • yesno

This feature was added as a convenience since C/C++ does not have named parameter support yet, and improves readability of code, especially when functions take a literal value as an argument.

Code: [Select]
void SomeFunction(bool doSomethingWild=true, bool doSomethingBoring=false);
void AnotherFunction(bool yesno)
{
     SomeFunction(/*doSomethingWild*/yesno, /*doSomethingBoring*/true);
}