Search code examples
pycharmapplication-settings

Duplicating file type in pyCharm


I have added a new file extension for a C dialect and would like to add a new keyword. However, if the file is associated with C/C++ adding new keywords would add them to all C/C++ files.

Creating new file type is and obvious option, but manually re-entering all C keywords is too laborious. There should be some a simpler way.


Solution

  • It turns out that the simplest way is to edit language that is extended which will create a file in filetypes/ (in directory @yole has mentioned). For example, for A C/C++ A C__.xml file will be created. Import is to register at least one extension with that file type! Only then, the file is created.

    Add new file type and register real extension. Copy keywords from C__.xml to Your file type.

    Clean up extensions and keywords from original file type.

    Restart.

    thanks @yole for pointers!