Bug 319418 - [search] web index for location may be assuming responsibility from standard index file when activated
Summary: [search] web index for location may be assuming responsibility from standard ...
Status: NEW
Alias: None
Product: JSDT
Classification: WebTools
Component: Web (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows Vista
: P3 normal with 1 vote (vote)
Target Milestone: Future   Edit
Assignee: Project Inbox CLA
QA Contact: Chris Jaun CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-09 13:56 EDT by Eugene Ostroukhov CLA
Modified: 2013-07-18 14:07 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Ostroukhov CLA 2010-07-09 13:56:21 EDT
In our application we have projects (mobile applications created with HTML+JS) configured as following:
1. "org.eclipse.wst.jsdt.core.jsNature" nature
2. "org.eclipse.wst.jsdt.core.javascriptValidator" builder.
3. HTML files and other assets are located in project root and subfolders (i.e. our "WebContent" folder is our project root)

We have an action that adds a library. Essentially all it does is copies JS files and other resources as needed and adds references to the JS file. The idea is to rely on JSDT to pick types and other APIs (though we had to introduce our InferEngine).

What happens is that types and other APIs are not always immediately available in the content assist. There is race condition so the behavior depends on environment.

Extended investigation had shown the following:
1. Project is created. For the project named "a" index file ".metadata\.plugins\org.eclipse.wst.jsdt.core\indexes\1835159913.index" is created and used to lookup types.
2. Library is added. Files are indexed and added to the project index located in "../org.eclipse.wst.jsdt.core/..".
3. In another thread index ".metadata\.plugins\org.eclipse.wst.jsdt.web.core\jssearch\1835159913.index" is created. It does not contain any types from the library. It is created when indexing HTML file in the project root.
3. Content assist does not show proposals from the library.
4. If I touch JS file from the library it gets reindexed and properly added to the new index (located in "../org.eclipse.wst.jsdt.web.core/.."). Proposals from the library will appear in the popup.

Note: this problem goes away if I diable org.eclipse.wst.jsdt.web.* plugins.
Comment 1 Eugene Ostroukhov CLA 2010-07-09 14:19:37 EDT
Seems like the core issue was that JsIndexManager did not index HTML files as it relies on resource listener to be notified of the resource changes. It adds resource change listener after the project is created and is not notified of the project files.

As a workaround I added "JsIndexManager.getInstance();" to our bundle activator "start()" method.