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

Bug 361489

Summary: Teach CDT Indexer to index c files with other extensions {like .ck, .hk etc} which have c source
Product: [Tools] CDT Reporter: Purush Gupta <purushgupta>
Component: cdt-indexerAssignee: Project Inbox <cdt-indexer-inbox>
Status: RESOLVED WORKSFORME QA Contact: Markus Schorn <mschorn.eclipse>
Severity: enhancement    
Priority: P3 CC: cdtdoug, recoskie
Version: 8.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Purush Gupta CLA 2011-10-19 22:38:24 EDT
Build Identifier: 20110916-0149

I use a toolchain that requires the c/h files be named with extensions .ck and .hk. I was wondering if there is a way that CDT indexer can treat those files during indexing operation

Reproducible: Couldn't Reproduce
Comment 1 Andrew Gvozdev CLA 2011-10-20 09:57:42 EDT
It is possible to make LanguageManager.getLanguageForFile() retrieve language from MBS toolchain InputType and we can use this bug to consider that.

But perhaps in your case you should define a new content type in plugin.xml
   <extension
         point="org.eclipse.core.contenttype.contentTypes">
      <file-association
            content-type="org.eclipse.cdt.core.cHeader"
            file-extensions="hk">
      </file-association>
      <file-association
            content-type="org.eclipse.cdt.core.cSource"
            file-extensions="ck">
      </file-association>
<!-- or
      <file-association
            content-type="org.eclipse.cdt.core.cxxSource"
            file-extensions="ck">
      </file-association>
-->
   </extension>
Comment 2 Chris Recoskie CLA 2011-10-20 10:22:02 EDT
If you add those extensions to the proper C/C++ content types, I would think this would just work.
Comment 3 Purush Gupta CLA 2011-10-20 11:40:10 EDT
(In reply to comment #2)
> If you add those extensions to the proper C/C++ content types, I would think
> this would just work.

Thank you for your replies. 

Tried following 'how to' from http://wiki.eclipse.org/CDT/User/FAQ

How can I add another extension to CDT so that files other than c/cpp/cc/h files are recognized as source files? My compiler needs the file extension to be "xyz", and when I open xyz files there is no syntax highlighting.

>>> Seems to do the trick for me, but I noticed the tooltip does not work, I need to provide further info probably in new feature req

Regarding suggestion 1, it seems like I may have to rebuild the CDT from source unless there is a way to to change the plugin.xml in the default disto
Comment 4 Andrew Gvozdev CLA 2011-10-20 12:16:41 EDT
Bugzilla is not really a proper place to ask questions, please use cdt-dev development list from https://dev.eclipse.org/mailman/listinfo if you are plugin developer, or if you are not a developer ask at user forums http://www.eclipse.org/forums/ (select CDT).

But answering your question, you need to add that to the plugin which defines the toolchain which uses .ck and .hk. As a user (if you are not developing plugin) you can associate file extensions with the content types in Preferences->General->Content Types.
Comment 5 Markus Schorn CLA 2011-10-31 10:13:38 EDT
I think the question has been answered.