Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 433037

Summary: Content assist "warmup" call is ambiguous
Product: [ECD] Orion Reporter: Mark Macdonald <mamacdon>
Component: ClientAssignee: Mark Macdonald <mamacdon>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 5.0   
Target Milestone: 6.0 M1   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Mark Macdonald CLA 2014-04-17 14:32:41 EDT
When the content assist engine initializes, it calls each provider's computeProsals()/computeContentAssist() method immediately. This is basically a hack to get better usability for providers that live behind a DeferredService -- we want to force their plugin to load eagerly, so they're ready to go when the user actually needs content assist. It avoids a long pause the first time content assist gets triggered while typing.

Unfortunately, this causes an ambiguous call to the provider's computeContentAssist() where a bunch of possibly-bogus data is passed in (eg. if the file hasn't loaded yet, they get an empty buffer).

We should consider moving this "warmup" call into an explicit service method like "initialize()". An actual API contract is preferable to overloading the computeContentAssist() method for 2 purposes.
Comment 1 Mark Macdonald CLA 2014-04-17 18:06:48 EDT
OK, merged:
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=9af9609

I added the initialize() method to the content assist providers that ship with Orion.

TBH, the recent move of functionality into webToolsPlugin and javascriptPlugin has made the content assist loading delay less of a problem. All our providers are now registered inside plugins which will get loaded early on due to the linting services they also provide. So the load-delay issue is now off the main path. 

Regardless, providers can implement initialize() to take advantage of the eager-load behavior.