Background parser enhancements

SyntaxEditor Brainstorming Forum

Posted 16 years ago by Damir Bulic
Avatar
I'd like to vote for the background parser service changes.

Now it's a queue and new requests are blocked until previous ones are handled. So I get a 5MB parse blocking 500 chars request.

I propose a pool of threads so that new small requests are done immeadiately if there are enough threads available. We could put a number of threads in the constructor. Also, ability to assign a priority to request would be additional nice touch.

I think it even shouldn't be a service, it should be a helper object providing background parsing. As it is now (not fitting to my requirements), I have to turn the service off in every application.

One more thing, two hashes passed to the service are a bit confusing to me. Why not simply add the new request and get an integer back? I think .NET auto increments internal counter each time an object is created, maybe we could use that to identify the Document parsed.

Comments (5)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Yes, the ability to support multiple threads would be beneficial. Right now do not that there are already priorities on requests with the editor receiving a higher priority than other parses normally.

How are you providing threaded parsing if you turn off the service? That means that it will use the main thread.

The two hashes are there on purpose to identify the source/target combination. You could have two requests from the same document but one goes back to the document and another goes to some other target. This allows you to keep those requests separate so they don't wipe each other out.


Actipro Software Support

Posted 16 years ago by Damir Bulic
Avatar
I made my own BackgroundParser class. Basically I extended BackgroundWorker so I can get immediate result for small amount of text.
I have a specific situation - Actipro parser is used to compile code in background and provide autocomplete to SQL Server Management Studio editor. Service made me wait for a second when I wanted to parse a few-lines of code, because user continued to type the large script.
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
One thing I like about Microsoft's VS design is that they have two ways to perform parsing. One thing you can do is call a Parse method that fires it in the same thread for immediate results. The other is to call BeginParse, which runs it in a separate thread.


Actipro Software Support

Posted 16 years ago by Eric J. Smith - CodeSmith Tools, LLC
Avatar
Yeah, that seems like a good model to me as well. But I think the big reason they have that model is because they pipe all requests through that model including intellisense, quickinfo and full parses.

I kinda like the idea of everything going through one location for semantic parsing including intellisense and quickinfo type stuff and having the ability to specify wether you want it to block or not.
Posted 16 years ago by Matt Whitfield
Avatar
Cheeky comment:

Make the background parser do the lexing too!