none
Editor Extensions, How to define keys that fire ICompletionSource.AugmentCompletionSession

    Question

  • Hello,

    I'm implementing a language service using the new SDK (with mef). Currently i'm working on intellisense based on MSDN walkthrough. This works well when normal chars are typed, but when it's another char like '.' or '{', AugmentCompletionSession isn't called.

    Could you please help me to implement this behavior ?

    Thanks

    Tuesday, June 19, 2012 11:58 AM

Answers

All replies

  • OK, sorry for that question, just need to modify some code provided in the sample.

    if (!typedChar.Equals(char.MinValue) && char.IsLetterOrDigit(typedChar))

    in Exec method of IOleCommandTarget implementation class

    Tuesday, June 19, 2012 12:20 PM
  • Hi Mathias,

    I’m glad to hear that you have found the reason.

    It will be very beneficial for other community members who have similar questions.

    Thanks,

    Ego

    Wednesday, June 20, 2012 2:42 AM
    Moderator
  • Hi, could you help me!

    in  MSDN walkthrough:

    " In this example, the identifiers and their descriptions are hard-coded in the AugmentCompletionSession method. In most real-world uses, you would use your language’s parser to get the tokens to populate the completion list."

     void ICompletionSource.AugmentCompletionSession(ICompletionSession session, IList<CompletionSet> completionSets)
        {
            List<string> strList = new List<string>();
            strList.Add("addition");
            strList.Add("adaptation");
            strList.Add("subtraction");
            strList.Add("summation"); // Hard code!!!
            m_compList = new List<Completion>();
            foreach (string str in strList)
                m_compList.Add(new Completion(str, str, str, null, null));
    
            completionSets.Add(new CompletionSet(
                "Tokens",    //the non-localized title of the tab
                "Tokens",    //the display title of the tab
                FindTokenSpanAtPosition(session.GetTriggerPoint(m_textBuffer),
                    session),
                m_compList,
                null));
        }

    How to do?

    Monday, April 03, 2017 1:53 PM