5

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.

KulaGGin
  • 943
  • 2
  • 12
  • 27
  • Hey, this is coming from the Support of R# -> https://resharper-support.jetbrains.com/hc/en-us/community/posts/206667595-Intellisense-with-Code-Snippets?page=1#community_comment_206450199 And this is a workaround -> https://stackoverflow.com/questions/2820446/using-vs-code-snippets-with-resharper Hope it helps. – Nekeniehl Mar 04 '19 at 10:48
  • 1
    Yeah, I saw these threads from 2010. I just thought that in 10 years they or community managed to fix it and show all VS snippets in Resharper IntelliSense. – KulaGGin Mar 04 '19 at 10:59

2 Answers2

8

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.

Alexander Kurakin
  • 13,373
  • 2
  • 33
  • 29
0

Just for completion that is how i did This picture shows the code. As Alexander did. Screenshot of code of property full template

This picture the configuration needed in Resharper Template editor in Visual Studio Screenshot of configuration

Another way to insert templates are the Mnemonic package extension of Resharper. That package has a lot of live templates for C#. See extension Live Template Extension Package

Joniale
  • 515
  • 4
  • 17