Visual Studio 2010扩展 [英] Visual Studio 2010 Extensions

查看:162
本文介绍了Visual Studio 2010扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Visual Studio 2010写我自己的抽象扩展,它与确定语言集成.

我有一个问题,是否可能将我自己的自动完成功能与VS的标准C ++自动完成功能进行混合?怎么做?是否需要使用VS库并调用某些方法?

I'm writing my own abstract extension for Visual Studio 2010, it makes similary functionality as Ook Language Integration.

I have a question, is it possibly to mix my own AutoCompletion with standart C++ autocompletion of VS? How to do it? Is in need to use libraries of VS and call some methods?

推荐答案

是关于向C#智能感知添加功能.

This is a very good example about adding features to C# intellisense.

首先,您应该捕获completionSession并使用它.

First of all you should capture the completionSession and use it.

类似于此代码段,但使用C ++

Like this snippet, but in C++

    [Export(typeof(IIntellisensePresenterProvider))]
    [ContentType("text")]
    [Order(Before = "Default Completion Presenter")]
    [Name("Object Intellisense Presenter")]
    internal class IntellisensePresenterProvider : IIntellisensePresenterProvider
    {
        [Import(typeof(SVsServiceProvider))]
        IServiceProvider ServiceProvider { get; set; }

        #region Try Create Intellisense Presenter

        #region Documentation
        /// <summary>
        /// Inject the IntelliSense presenter
        /// </summary>
        /// <param name="session"></param>
        /// <returns></returns>
        #endregion // Documentation
        public IIntellisensePresenter TryCreateIntellisensePresenter(IIntellisenseSession session)
        {
            #region Validation (is C#)

            const string CSHARP_CONTENT = "CSharp";
            if (session.TextView.TextBuffer.ContentType.TypeName != CSHARP_CONTENT)
            {
                return null;
            }

            #endregion // Validation

            ICompletionSession completionSession = session as ICompletionSession;
            if (completionSession != null)
            {
                var presenter = new IntelliSenseViewModel(ServiceProvider, completionSession);
                return presenter;
            }
            return null;
        }

        #endregion // Try Create Intellisense Presenter
    }

希望有帮助!

这篇关于Visual Studio 2010扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆