PyCharm 2019+ Change File Association and File Types

PyCharm / IntelliJ recognize most file types automatically by catalog of file types and associations (there is a difference between Community and Professional edition).

If you try to open unknown file type in PyCharm / IntelliJ 2019+ you will be asked to Register New File Type Association (for example 1.xyz):

pycharm_file_types_association

In this window you have two options:

  • Open matching files in PyCharm / IntelliJ
    • In this option you can select appropriate viewer for the given file type
  • Open matching files in associated application

In case of a wrong association you may want to change default behavior of how given file extension is open in PyCharm. This can be done by following next steps:

  • PyCharm
  • Settings - CTRL + ALT + S
  • Editor
  • File Types (or simply search for it)
  • Click Somewhere under - Recognized File Types
  • Type the file extension - i.e - ipynb
  • The selection will change to the File Type which is registered for this extension:

pycharm_registered_file_types

From the image it's visible that this extension will be opened with JSON view. If you want to associate the file type with text viewer than you can remove it from JSON view by selecting the extension .ipynb and minus next to it. Then go to Text view and add .ipynb in the Registered Patterns.

Note 1:

Each set of keywords has its own highlighting that you can modify. To do so, in the Settings/Preferences dialog (Ctrl+Alt+S), select Editor | Color Scheme | Custom, and edit the Keyword1, Keyword2, Keyword3, and Keyword4 properties.

Which means that you can create your own file type with keywords and highlighting.

Note 2:

In IntelliJ IDEA, recognized files are not always supplied with extensive support. For example, PHP files are recognized in the Community Edition and marked with the corresponding icon, although this edition does not provide PHP development support.

So you can check if Professional edition support the file types and buy it if you are interested in.

Resources

Related Article