How to extend IntelliSense items?

假装没事ソ 提交于 2019-11-27 14:40:58

This is definitely doable very easily by writing a ReSharper plugin.

  • Start by implementing ICodeCompletionItemsProvider which will provide additional IntelliSense items. The easiest way is to inherit from ItemsProviderOfSpecificContext<TContext> (with TContext being CSharpCodeCompletionContext if you're interested in C# code completion).

  • Your provider will add the additional items in the implementation of AddLookupItems(). You have the chance to provide a custom implementation of ILookupItem here: the Accept() method of this interface will be called when the user chooses the item in the completion popup. Here is your chance to execute the code you need.

Note that this information is for R# 6.1/7.0. I don't think it is much different in previous versions though. Obviously, you have to enable ReSharper IntelliSense instead of Visual Studio IntelliSense for this to work.

Sajib Mahmood

Customized intelliSense for VS2010 XML editor can be added by putting customized xsd files in C:\Program Files\Microsoft Visual Studio 10.0\Xml\Schemas folder but I guess you are looking for something more.

You should take a look at Creating and Using IntelliSense Code Snippets and decide whether it is what you are looking for. This question on programmers.stockexchange might also be helpful. This question also seems similar which suggests CSharpIntellisensePresenter(Free).

Maybe ReSharper's Live Templates can help you (ReSharper->Live Templates...).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!