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.

3
  • much easier to make your own snippets because when you update VSC your modified default snippets will be gone Commented Jul 9, 2020 at 1:24
  • @rioV8 But then 2 snippets will show up every time I write 'if' and I'll have to select the one I created... Commented Jul 9, 2020 at 11:43
  • then prefix your custom snippets with a c, instead of if type cif Commented Jul 9, 2020 at 11:55

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.