CSharpCompletionProvider: Adding Members to completion list

SyntaxEditor .NET Languages Add-on for WPF Forum

Posted 10 years ago by P. O. - Inosoft GmbH
Version: 12.1.0560
Avatar

Hello!

I am using a subclass of CSharpCompletionProvider to modify the completion list of the syntax editor.

I override OnSessionOpening and add my own CompletionItems. Every time the user writes an expression and presses "." OnSessionOpening is called. But in some cases the completion list is completely empty and the method is not called. Is it possible to add an item to the completion list in this case?

The only override called in this case is RequestSession! But even returning "true" does not do the job.

 

Thanks for your help :)

Comments (2)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

The OnSessionOpening method will only be called if the add-on was able to resolve and find at least one item to show for an expression.  If at least one item was found, it will create the CompletionSession and initialize it with the items found, then will call OnSessionOpening for filtering.  This method occurs before the session is actually opened.  Unfortunately if no items were initially found (meaning the expression didn't resolve properly), then OnSessionOpening won't be called.

Note that you can override the CreateContext method of the completion provider.  That method expects an IDotNetContext to be returned.  The RequestSession method calls that at its start and tries to resolve the context.  So you could perhaps alter the context in such a way perhaps so that the resolve is able to occur in the problem scenario.


Actipro Software Support

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

On a side note, the next build (2016.1 build 632) will now call OnSessionOpening for all our language add-ons, even when no items were found by a context/resolver.  This will allow you to inject your own easily in any situation.


Actipro Software Support

The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.