visual-studio 在 Resharper 中使用 VS Code 片段

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2820446/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 11:57:41  来源:igfitidea点击:

Using VS Code Snippets with Resharper

c#visual-studioresharpercode-snippets

提问by devoured elysium

I am trying to use Code Contract's Code Snippets but since I turned Resharper back on it doesn't recognize them. On the other hand, it is recognizing some snippets I've implemented myself in the past.

我正在尝试使用 Code Contract 的 Code Snippets,但由于我重新打开了 Resharper,它无法识别它们。另一方面,它正在识别我过去自己实现的一些片段。

Any ideia of what might be the problem? I'm specifically trying to use crand ce, which I think, don't collide with any other snippets (at least from what I see in the intellisense).

任何想法可能是什么问题?我特别想使用crand ce,我认为它不会与任何其他片段发生冲突(至少从我在智能感知中看到的)。

I'm using R# 5 with VS 2010

我在 VS 2010 中使用 R# 5

Thanks

谢谢

回答by ElusivDangerBoy

Press CTRL+Jthen type your snippet shortcut... this is mentioned hereon the Resharper site

CTRL+J然后输入您的代码段快捷方式... Resharper 网站上提到了这一点

回答by vaughan

Thisanswer demonstrates another work around.

这个答案展示了另一种解决方法。

  1. Right-clicking in your code editor and selecting "Insert Snippet"

  2. CTRL+K,X

  1. 在代码编辑器中右键单击并选择“插入代码段”

  2. CTRL+ K,X

This is what I am using to use mvvmlight snippets.

这就是我用来使用 mvvmlight 片段的内容。

回答by mikeesouth

I have the same problem and would gladly see a solution. The snippets work even though they won't show up in the intellisense popup, so if you hit "cr"+tab you would probably get the snippet anyway.

我有同样的问题,很高兴看到解决方案。即使片段不会出现在智能感知弹出窗口中,它们也能工作,因此如果您点击“cr”+tab,您可能无论如何都会得到片段。

There is a "workaround" though. If you go to open the ReSharper settings and Environment->IntelliSense->General and change from ReSharper to Visual Studio intellisense mode. This will make your snippets show as expected, however some of the resharper intellisense additions won't be available.

不过有一个“解决方法”。如果您打开 ReSharper 设置和 Environment->IntelliSense->General 并从 ReSharper 更改为 Visual Studio 智能感知模式。这将使您的片段按预期显示,但是某些 resharper 智能感知添加将不可用。

I've tried with the latest nightly build of ReSharper 5.1 and it's still not fixed, unfortunately.

不幸的是,我已经尝试过 ReSharper 5.1 的最新夜间版本,但仍未修复。

Hope this helps.

希望这可以帮助。