Prism Snippets在使用ReSharper的Visual Studio 2017中无效

问题描述 投票:2回答:1

我正在使用Visual Studio 2017和Prism Template Pack。

Prism片段工作正常,直到我安装了Resharper。现在我可以插入棱镜片段的唯一方法是

编辑 - > Intellisens - > InsertSnippet [Ctrl + K,X]。

它们没有在Intellisense中弹出,双键标签在我输入代码段时也不起作用。我试图禁用/启用Prism Template Pack并重新安装它,但没有任何成功。

有人可以提供有关如何让它们重新工作的任何提示,而无需将它们重新命名为标准的Visual Studio片段吗?

P.S Visual Studio片段(prop,propg)正常工作。

c# visual-studio resharper prism
1个回答
2
投票

滑稽! Juts现在!我有同样的问题!我在那里搜索并发现了这些QA:How to disable ReSharper property code autocomplete/code snippetReSharper - How to show custom snippet in IntelliSense

在两个答案中,他们都说:

  • 禁用Resharper代码段以使用Visual Studio代码段
  • 从Visual Studio转到ReSharper | Template Explorer | C# | New Template菜单并为Resharper创建新代码片段。

我更喜欢第二种方式。要了解更多关于Resharper中Template Explorer的信息,你可以阅读它here

但特别是对我们的问题!我使用以下步骤将Prism代码片段添加到Resharper :(另外,您可以为MVVM Light Toolkit代码片段执行相同的操作或...)

  1. 查找Prism代码片段文件夹位置。 (或MvvMLight或......):我认为最简单的方法是转到:Visual Studio | [Menu] Tools | Code Snippets Manager... | [Language]CSharp | Select Prism from tree,然后将其Location复制并粘贴到Windows Explorer地址栏中。然后,您将获得Prism的所有代码片段文件。
  2. 打开您需要使用文本编辑器将其添加到Resharper中的任何*.snippet文件。
  3. 为Prism代码段创建Resharper模板。从Visual Studio转到[Menu]ReSharper | Tools | Template Explorer...然后从Templates Explorer窗口/ Tab中选择C#语言(从Scopes面板)并单击工具栏中的Resharper - New Template - Toolbar Icon图标。它将在Visual Studio中打开一个Template <No Name>选项卡。看起来像下面的图像:

enter image description here

  1. 从Prism文件复制原始代码段或自己编写。从您在文本编辑器的第2步中打开的*.snippet文件中,在<Code Language="csharp"><![CDATA[之间复制$end$]]>部分的行,如下图所示,然后将其粘贴到Visual Studio | Template <No Name>选项卡中:

enter image description here

  1. 你必须给它一个Shortcut名称和可选的Description然后点击Visual Studio中的Save按钮。 (您可以使用*.snippet文件中的相同代码或根据需要更改它!)我将其更改为此以使Resharper更加快乐!大声笑:

enter image description here

完成!

在我的情况下,如果我输入propp并按Tab键一次,它将为我创建Prism Preoperty模板!我希望这也可以帮助别人!

快乐的编码!

© www.soinside.com 2019 - 2024. All rights reserved.