locked
ICompletionSession.Filter Method Options? RRS feed

  • Question

  • Hi,

    Using the sample code from the walkthrough, "Displaying Statement Completion" I was able to implement an intellisense session.

    http://msdn.microsoft.com/en-us/library/ee372314.aspx

    However, when the completion comes up, it seems to match based on the first characters of the word, rather than if the completion contains the words.  So from the example, if you type "ad", you will get a completion for "addition" and "adaptation," but typing a "t" results in no match.

    I would like to mimic the Visual Studio behavior where it will match based on if it finds it in the middle of a word.  For example, if you type "string" you will get "string" and "ToString" in the completion results.

    How would I go about implementing this?  I found a post implying that the Filter method had options, but did not see anything more on this.

    Thanks

    John

    Tuesday, August 31, 2010 4:15 AM

Answers

  • Hi John,

    There isn't an easy way to do this. I checked with the editor team and they indicated that the general process would be to write a custom completion source that grabs the earlier (shim) completion source in your AugmentCompletionSession and wrap it.

    Then produce a custom completion set that overrides the Filter/SelectBestmatch/Recalculate methods. This will be tricky part where you would try to replicate the exiting VS benavior.

    Then create a custom completion controller to call Commit() (when you see the TAB command for example).

    As far as I'm aware, there are no examples that actually do this, but that's basically the outline the dev team suggested when I hit them up for suggestions last week. Hopefully, that'll at least get you pointed in the right direction.

    Sincerely,


    Ed Dore
    Monday, October 4, 2010 10:02 PM