Extension for vscode: Bringing “surround with” functionality to vscode.

Quite often, in my day-to-day workflow, I want to wrap up some code sections in a well-known code snippet. I hate these moments. Usually, you want to cut and paste some code, and after that formatting goes wrong and all of that 😱. So…

I would like to share with you an extension for vscode that I wrote for personal use. (marketplace.visualstudio.com/surround-with-csharp) The goal of this extension is to provide the capability to wrap up selected text in a C# code snippet.

This extension supports different concepts to trigger functionally to surround your code.

Source code: https://github.com/NikiforovAll/surround-with-csharp

CompletionProvider

You can just simply hit and if you have some code selected, you will get completion items that you can choose from by using arrow keys:

Commands

If your favorite command-pallette. You can invoke command “C#: Surround With” (or ) and you will be prompted for a code snippet.

Hope you find this useful, have fun! 🎉

Originally published at https://nikiforovall.github.io.

Software Engineer at EPAM