Modify default C++ snippets in VS Code
Asked Answered
S

1

9

I would like to modify the default code snippets for C++ in Visual Studio Code. I've found a similar question here, but they actually show how to create your own snippets - and not how to modify the default snippets.

The reason I want to do this is because I'm used to doing some things a bit differently than how they are done in the snippets. For example, this is what appears when I use the if snippet:

if (/* condition */)
{
    /* code */
}

And I would like it to be like this:

if(/* condition */){
    /* code */
}

Is there any way to achieve what I want to do? Thank you.

Soloist answered 8/7, 2020 at 19:27 Comment(3)
much easier to make your own snippets because when you update VSC your modified default snippets will be goneRefreshment
@Refreshment But then 2 snippets will show up every time I write 'if' and I'll have to select the one I created...Soloist
then prefix your custom snippets with a c, instead of if type cifRefreshment
G
2
  1. Press Ctrl + ,(opens vs code settings);
  2. Type "snippet" in settings search bar;
  3. In Extentions List choose C/C++
  4. Untick "Suggest Snippets" button;
  5. Close settings tab.
  6. Go to settings again and create new User Snippets 😊as you liked.enter image description here
Greatly answered 10/2, 2022 at 11:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.