pythonvisual-studio-codetextmate

Changing the colour of Python docstring params in VS Code


I'm looking to change the colour (or highlight) of params in Python docstrings in VS Code.

I had some look into themes, but I don't quite understand how I could add a custom scope using TextMate.

On the image below, you can see the :param: are the same colour as the string. I'm looking for it to be a different / custom colour.

Might also look into highlighting the return types such as str or dict.

I'd really appreciate any and all help!

Code Snippet


Solution

  • The doc string is colored as a normal string.

    Use the extension Highlight to specify which text should have a different color

      "highlight.regexes": {
        "(:(?:param|return))( \\w+)?(:)": {
          "regexFlags": "g",
          "filterLanguageRegex": "python",
          "decorations": [
            { "color": "blue" },
            { "color": "green" },
            { "color": "blue" }
          ]
        }
      }