PerformSemanticParse(...) invocation

SyntaxEditor for Windows Forms Forum

Posted 16 years ago by Tim Winquist - CTO, Analysis, Integration & Design, Inc.
Avatar
When I load a document with SyntaxEditor, the PerformSemanticParse(MergableLexicalParserManager manager){...} method is invoked in my DynamicOutliningSyntaxLanguage derived class. Next, when I press the space bar with the caret within existing whitespace the PerformSemanticParse(MergableLexicalParserManager manager){...} method is again invoked. I totally expect this since adding a whitespace in the document changes the document, which should require a reparse.

However, on all subsequent depressions of the space bar within any other whitespace anywhere in the document, the PerformSemanticParse(MergableLexicalParserManager manager){...} method is not invoked. Ever. It is only invoked upon the first depression of the space bar. Is this behavior expected? Is the behavior correct? I wouldn't think so since adding whitespace in the document changes the location of all tokens following that space. Has this behavior been fixed in recent revisions? I am currently using version 4.0.0251.


Any help would be greatly appreciated.
Thanks.

Comments (6)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Tim,

I'm not sure about that older build (we're on 262 now) but the way it should be working now is that when a key is pressed, it will place a semantic parse request in the queue. If the semantic parser service isn't busy, that starts right away. Now say that while that is executing, another key is pressed. A second request is added to the queue. Let's assume the first request is still being processed and a third key is typed. The second request is pulled from the queue and a new one is added. So the gist is that the latest keystroke should always have a request placed on the queue if it isn't already being processed and we ignore all the others in between. Make sense?


Actipro Software Support

Posted 16 years ago by Tim Winquist - CTO, Analysis, Integration & Design, Inc.
Avatar
That makes sense. I know that was how it works. In my case, I am debugging and I know that there are no pending requests each time I press the space bar (add whitespace). It only reparses the first time I add a whitespace. Can you please verify that this is not the correct behavior? I don't think it should behave this way.

I know that the behavior I am describing is accurate because I set a breakpoint inside the implementation of the PerformSemanticParse(MergableLexicalParserManager manager){...} method.

Thanks again.
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Tim,

I was reading your original post again, do you use the semantic parsing service or do you use a dynamic language and have the semantic parsing in the same main UI thread?

My original reply was more for if you are using the semantic parser service so perhaps what I said was incorrect in your scenario. But it does sounds like you are using the service if you are talking about PerformSemanticParse(MergableLexicalParserManager manager){...}.

However I just loaded the dynamic C# language in the SDI Editor sample and was pressing space and had a breakpoint on PerformSemanticParse (not the overload version that takes the MergableLexicalParserManager), the other one. That main one fired each time ok.

The best thing I can say is to have you try the latest maintenance release first and if you think there is an issue with that, send over a tiny sample project that shows it happening. There could be a problem with our code or a problem on what you implemented on your end. So that would narrow it down.


Actipro Software Support

Posted 16 years ago by Tim Winquist - CTO, Analysis, Integration & Design, Inc.
Avatar
I figured out the issue.

In my overridden OnSyntaxEditorTriggerActivated(SyntaxEditor syntaxEditor, TriggerEventArgs e){...} method (a whitespace is my trigger), I invoke the method SemanticParserService.Stop().

However, I don't understand why this is an issue because before leaving the method, I invoke the method SemanticParserService.Start(). My intent was to not allow a reparse during execution of the code in the OnSyntaxEditorTriggerActivated method.

Thanks again,
Tim
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Yes that would do it. Stop kills the worker thread immediately. Your parsing was probably occuring at the time you called Stop and therefore it never finishes.


Actipro Software Support

Posted 16 years ago by Tim Winquist - CTO, Analysis, Integration & Design, Inc.
Avatar
Thanks again for your help!

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

Add Comment

Please log in to a validated account to post comments.