Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356632 - Indexer ignores content type to language binding
Summary: Indexer ignores content type to language binding
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 8.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 8.0.2   Edit
Assignee: Markus Schorn CLA
QA Contact: Doug Schaefer CLA
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2011-09-02 14:49 EDT by Eugene Ostroukhov CLA
Modified: 2013-05-24 15:29 EDT (History)
0 users

See Also:


Attachments
First revision of the patch (2.85 KB, text/plain)
2011-09-02 14:49 EDT, Eugene Ostroukhov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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