DEV Community

Cover image for VSMac Tools | Code Snippets
Wahid Abduhakimov
Wahid Abduhakimov

Posted on

VSMac Tools | Code Snippets

Creating your own code snippets in Visual Studio for Mac to boost your day-to-day productivity has never been easier.

Snippets Tool

The tool is better explained in detail here with fancy words that I can't use 🙂.

Here, I am just going to create a code snippet for Observable Property that we love to use, especially in Xamarin.Forms ViewModels.


  • First, we have to open Snippets Tool window on VSmac. You can find it under Preferences > Text Editor > Snippets Alt Text

  • From languages available, select C# since we are making a code snippet for C#. Then, click Add button on the right. This will pull up a whole new window where you can create your own cool snippets. Fill in all the fields like I have here. Alt Text

Let's talk about the keywords in the snippet.

  • Be sure to check ✅ the Is expandable template so that you can insert the snippet by typing the shortcut and TAB twice.
  • Snippet has template text like $type$ and $name$ which will be replaced by the real name and type later.
  • $end$ template text is where the cursor position will be after the template is created.

Lets see it in action!

Gist

Top comments (0)