Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show all Visual Studio's code snippets in Resharper's IntelliSense?

Resharper's IntelliSense only shows its own Live Templates but not Visual Studio's code snippets.

Is there a way to make Resharper IntelliSense to show all VS code snippets?

In Templates Explorer of Resharper I found that it has many Live Snippets marked as Imported Visual C# Snippets

enter image description here

But it didn't import all of them, only some of them. For example, Resharper didn't import propfull code snippet from Visual Studio(as you can see on the first screenshot propfull isn't on the list): enter image description here

I can't find a feature in Resharper to import VS code snippets manually, one by one, or all of them together. I tried Import... button in Live Templates Manager in Resharper but apparently it only allows to import Live Templates(.DotSettings and .XML files, not .snippets files), but not Code Snippets files. Is it possible to import VS code snippets somehow?

All I want is to somehow make all VS code snippets work in Resharper IntelliSense. Maybe there's some third party tool that allows to convert snippets into Live Templates or something? Thanks.

like image 478
KulaGGin Avatar asked Mar 04 '23 10:03

KulaGGin


1 Answers

ReSharper does not import any VS templates on installation or on the first launch. All templates you see in Template Explorer were manually added to default settings of ReSharper - there is no a "Code Snippets to Live Template" converter https://youtrack.jetbrains.com/issue/RSRP-273779.

So, if you would like to get propfull template in Live Templates, you have to create it manually - open ReSharper | Tools | Templates Explorer | Live Templates | C# | New Template and put following code there:

private $TYPE$ _$Var$;

public $TYPE$ $Property$ 
{ 
    get { return _$Var$; } 
    set { _$Var$ = value; } 
}

and adjust Var placeholder: Value -> Choose Macro -> "Value of another variable with the first characters in lower case" -> OK -> "another variable" -> Choose "Property". Also Editable Occurrence -> Not editable. Then change the order of placeholders for the new added template to be the following: - Type - Property - Var

In this case, Var will inherit a correct name from Property.

like image 182
Alexander Kurakin Avatar answered Apr 05 '23 20:04

Alexander Kurakin