Update CompletionList with new local variables

SyntaxEditor for WPF Forum

Posted 2 years ago by Josh
Version: 18.1.2
Avatar

Hello!

We have turned the AmbientParseRequestDispatcherProvider.Dispatcher on, and when typing the following code:

int foo;

From there, the user will type "f" to being a word, and we are bringing up the completion list, but since the parsing is not done yet, the AST node for foo variable is not yet created in the parse results, so the completion list is blank.  

Whats the recommended way to update the completion list?

Thanks!

Comments (3)

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

Hi Josh,

You could watch the DocumentParseDataChanged event and request a new completion session if that event fires and a completion session is currently open (check the editor.IntelliPrompt.Sessions collection).  The problem there is that it will lead to some flickering as the completion list closes and reopens, and the scroll state might be slightly different.

One thing that might help is if you track the original snapshot when the completion session started.  Only request the new session if you get parse data changed event for that snapshot.  That way you only refresh it up to once and if it's the exact parse data you want.

A similar idea would be to watch for the DocumentParseDataChanged event for the specific original snapshot as above, but instead of requesting a new session, add any new completion items to the existing completion session.  That might reduce the brief close/open flicker, but is a lot more work than the first idea.


Actipro Software Support

Posted 2 years ago by Josh
Avatar

Thank you for the information.

I have also tried the following:

AmbientParseRequestDispatcherProvider.Dispatcher?.WaitForParse(ParseRequest.GetParseHashKey(editor.Document));

And that seems to help right before we bring it up.

What does your .net c# plugin do to handle this?

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

All our premium add-on syntax languages simply use the regular IParser mechanism to do all parsing tasks and don't do anything extra.


Actipro Software Support

The latest build of this product (v24.1.3) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.