4

I am using pycharm for a python project that I am working on. I have several cfg files and a .pylintrc file in the root directory.

However, these files are not detected by pycharm for syntax highlighting. For example, WebStorm detects the .eslintrc file and highlights the syntax quite elegantly.

Pycharm suggested Context-Free-Grammer plugin for the cfg files, but I don't think that it is the correct type for python cfg files.

How can I configure pycharm to properly highlight cfg files?

Here is an example cfg file I have,

[tool:pytest]
addopts =
    --cov-config .coveragerc
    --cov-report html
    --cov=pulse_agent

Edit: Basically, many .cfg and .conf files in python are in ini syntax. See my answer below.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Pubudu Dodangoda
  • 2,742
  • 2
  • 22
  • 38

1 Answers1

4

Turns out, all python configuration files are in standard ini format. https://en.wikipedia.org/wiki/INI_file

Thus, for enabling syntax highlighting in pycharm, I had to follow the following steps.

  1. Right click setup.cfg file
  2. Select "Associate with File Type option"
  3. Select Ini
Pubudu Dodangoda
  • 2,742
  • 2
  • 22
  • 38