Visual Studio 2010 扩展

发布于 2024-10-22 19:26:29 字数 243 浏览 1 评论 0原文

我正在为 Visual Studio 2010 编写自己的抽象扩展,它具有与 Ook 类似的功能语言集成

我有一个问题,是否可以将我自己的自动完成功能与 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雾里花 2024-10-29 19:26:29

这是一个关于向 C# 智能感知添加功能的非常好的示例。

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

喜欢这个片段,但是用 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
    }

希望有帮助!

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

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

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
    }

Hope helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文