Visual Studio 2010 Extensions
Asked Answered
G

1

2

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?

Gaff answered 18/3, 2011 at 7:33 Comment(0)
A
1

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!

Adlee answered 28/3, 2011 at 19:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.