I'm working on a project while involves TOM files (.t extension), which get compiled into .c files. Now, I've told my Eclipse to treat them like C sources files, but the CDT indexer doesn't seem to want to touch them. Is it possible to tell it to consider additional filetypes?
Note: TOM files look just like C files but with some additional syntax, which would just look like syntax errors on some lines to the indexer.
The easiest way to do this is define a new association. To do this on your project, open
Project Properties->C/C++ General->File Types, then selectUse Project Settingsand define a new extension:You can also define this at the workspace level,
Window->Preferences->C/C++->File TypesThis should give you most of what you want. For example, (I don't actually know TOM), I have a simple project with 1 C file, 1 H file and 1 T file. All the features you want and expect just work:
If you want more
If you want more, this can be done, but not without writing your own Eclipse plug-in that understands a little bit about
*.tfiles. Fortunately, it takes only a few lines of XML. By the end of this you should end up with basically the same functionality as above, but you have a starting point for your very own TOM plug-in.What you need to do is define a Content type by extending the
org.eclipse.core.contenttype.contentTypesextension point (there is also some older docs that gave a run through)In your
plugin.xmlthis would look something like:You might consider making the
base-typesomething other than plain text, e.g. you could make itorg.eclipse.cdt.core.cSource.Then you need to define a new language, called for our purposes TOM Language. You do this with the
org.eclipse.cdt.core.languageextension point.An example of what this might look like is:
The class,
GCCLanguageis the standard GCC one. Of course if you want to further improve support, adding or customizing parser is an option (to remove those syntax errors about tom stuff) you could extend the GCCLanguage or one of the other classes in the hierarchy.Once you have done all that and added your new plug-in to your Eclipse install, you will have TOM file support.
If you have read to the end, you might find it useful to simply fork https://github.com/jonahkichwacoders/com.kichwacoders.tom.core which contains all the code above?