You can create custom file types to enable parsing these files in the editor by defining highlighting schemes for keywords, comments, numbers, etc. To enable PyCharm to decide how to treat a file, you need to associate each file type with relevant extensions.
- Open the Settings dialog by choosing File Types. Find more on page Accessing Settings. . Then select
- On the File Types page that opens, click the Add button .
- In the New File Type dialog box that opens, specify the name of the new type and optionally provide a description.
- In the Syntax Highlighting section, specify the characters for line and block comments, hex prefixes, and number postfixes.
- In the Keywords section, specify sets of keywords using the tabs
from 1 to 4. To do so, select the desired tab, click (Alt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+Insert or Ctrl+NAlt+Insert⌘ N or Control EnterControl N or Control Enter⌘ N or Control Enter),
and enter the keyword
name in the Add New Keyword dialog box that opens.
Each set of keywords has its own highlighting. You can change the highlighting color scheme for each set, on the Colors and Fonts settings page. Click the Custom tab and edit the Keyword1, Keyword2, Keyword3, and Keyword4 properties.
- Open the File Types settings page.
- From the Recognized File Types list, select the desired type.
- In the Registered Patterns area, complete the list of patterns that define the file extensions
to indicate that the corresponding files belong to the selected type. Do one of the following:
- To register a new pattern, click (Alt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+Insert or Ctrl+NAlt+Insert⌘ N or Control EnterControl N or Control Enter⌘ N or Control Enter) and enter the desired extension pattern in the Add Wildcard dialog box that opens.
- To update a pattern, select it in the list, click the Edit button and make the necessary changes in the Edit Wildcard dialog box that opens.
- To remove a pattern from the list, select it and click (Alt+DeleteAlt+DeleteAlt+DeleteAlt+DeleteAlt+DeleteAlt+DeleteAlt+DeleteAlt+Delete⌘ Delete⌘ Delete⌘ Delete).