Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typescript Snippets on Visual Studio

I would like to know if any of you guys know a way to enable the following feature on Visual Studio (either a hidden setting or an extension):

I'm used to javascript development on Visual Studio where if I type: "if" on the text editor, it shows me a popup ("code snippet for an if statement"). Pressing ENTER the following is added:

if (true) {

}

This is not available for typescript files!

These snippets are really useful and this is just a simple example

Another basic feature I'm missing is "braces auto completion".

I am not sure if there is a way to enable it or not, but really would like these basic features available.

This also applies for the newly released Visual Studio 2015. On the other hand, Visual Studio Code seems to handle it very well.

like image 770
HobojoeBr Avatar asked Oct 16 '15 21:10

HobojoeBr


People also ask

How do I activate snippets in Visual Studio?

On the menu bar, choose Edit > IntelliSense > Insert Snippet. From the right-click or context menu in the code editor, choose Snippet > Insert Snippet.

Can I use Visual Studio for TypeScript?

For projects developed in Visual Studio 2022, we encourage you to use the TypeScript NuGet or the TypeScript npm package for greater portability across different platforms and environments. For more information, see Compile TypeScript code using NuGet and Compile TypeScript code using tsc.


1 Answers

There is an issue on Github about being able to use Javascript snippets in Typescript files, and to make the Snippet Code Manager being able to recognize Typescript as a Language. https://github.com/Microsoft/TypeScript/issues/312

like image 83
Adrien SAMBRES Avatar answered Oct 08 '22 22:10

Adrien SAMBRES