Visual Studio IDE Code snippet to convert field from upper case to lower case

Tryer_Git 1 Reputation point
2021-09-26T17:56:39.23+00:00

I would like to accomplish the following in a C++ class via a Visual Studio 2019 IDE code snippet:

Link here, reproduced below:

135247-peek-2021-09-26-23-11.gif

which creates a variable name (to hold a constant) in UPPERCASE letters and creates related function names in lowercase of the same name.

The above is accomplished in VSCode via the following code snippet:

"var set getx":{  
		"prefix": "varsetgetx",  
		"body":[  
			"${1:int} ${2:VARNM};",  
			"$1 ${2/(.*)/${1:/downcase}/}(){return $2;}",  
			"void ${2/(.*)/${1:/downcase}/}($1 val){$2 = val;}"  
		]  
}  

Is there a way to accomplish this in Visual Studio IDE 2019? There seems to be only one other question I could find, but that is from back in 2006, more than 15 years ago. That thread is here.

The answer on that thread unfortunately was that it would not be possible to accomplish something like this. Is it still the case that this is not possible now using the latest VS 2019 IDE?

Thank you.

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,518 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Sam of Simple Samples 5,516 Reputation points
    2021-09-26T18:58:34.607+00:00

    The name snippet implies adding code. I think you are trying to change existing code and that is not what snippets are designed for. I think that is what the other answer is saying. If I misunderstand what you are saying then please explain what you need without the animation.


  2. Minxin Yu 9,866 Reputation points Microsoft Vendor
    2021-09-27T09:43:39.463+00:00

    Hi,

    I suggest you directly suggest this feature to Visual Studio Product Team in our Developer Community, and if you do suggest this feature, please share the link here, other forum members who are interested or needed this feature will go to vote for this thread.

    Best regards,

    Minxin Yu


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  3. Tryer_Git 1 Reputation point
    2021-09-27T15:22:48.223+00:00
    0 comments No comments