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

Bug 356632

Summary: Indexer ignores content type to language binding
Product: [Tools] CDT Reporter: Eugene Ostroukhov <eostroukhov>
Component: cdt-coreAssignee: Markus Schorn <mschorn.eclipse>
Status: RESOLVED FIXED QA Contact: Doug Schaefer <cdtdoug>
Severity: normal    
Priority: P3 Keywords: contributed
Version: 8.0   
Target Milestone: 8.0.2   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
First revision of the patch none

Description Eugene Ostroukhov CLA 2011-09-02 14:49:21 EDT
Created attachment 202693 [details]
First revision of the patch

Currently indexer always relies on default content type to language binding. This becomes an issue, for instance, if custom parsing is needed for files that have default C/C++ extensions (e.g. .h)

Please note that the patch attached ignores build profile as set on the indexer project properties page (I will implement this in a later revision of the patch).

I would like to suggest having content type<->language bindings always go through the preferences as it will make the behavior of the indexer/build system/etc more consistent and will allow customizing the bindings on the product level.

Another thing I prototyped and can create a patch is making CContentTypes::getContentType take content type hierarchy into the account. For instance if I have a content type com.mycompany.mylangheader bound to ".h" file extension and set CDT header content type as its base then CContentTypes would prefer it to CDT built-in header type. Currently it always picks CDT one and ends up using GPPLanguage to parse it.

Allowing custom content types would allow binding languages to some headers that have .h extension but have specific names or some specific content (using the content describers).
Comment 1 Markus Schorn CLA 2011-09-07 06:32:55 EDT
Thanks, I have applied your patch.
Comment 2 CDT Genie CLA 2011-09-07 07:23:02 EDT
*** cdt git genie on behalf of Eugene Ostroukhov ***

    Bug 356632: Project specific language mappings

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=b91945ccac8f23656084a3d303bb7c59a5e339c4
Comment 3 CDT Genie CLA 2011-09-19 08:23:02 EDT
*** cdt git genie on behalf of Markus Schorn ***

    Bug 356632: Follow up porting fix to 8.0.2.

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=6337c3d624a192fca79949497a2ab69f3a7088fc
Comment 4 CDT Genie CLA 2011-09-19 08:23:11 EDT
*** cdt git genie on behalf of Eugene Ostroukhov ***

    Bug 356632: Project specific language mappings

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=36e3d3ad1109729bb5cf9631bfc36ce3fbd511f1