Reputation: 78
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!
Upvotes: 1
Views: 2323
Reputation: 2151
The VSCode extension "Python Sphinx Highlighter" may help. I use it for :param
highlight.
Upvotes: 0
Reputation: 28663
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" }
]
}
}
Upvotes: 1
Reputation: 1447
Since this is inside the docstring there's not much you can do easily. AFAIK themes are based on the language servers definitions in the language. Docstrings are considered a whole "thing" so you can change the whole docstring colour, but not content within the docstring.
You could probably do this if you wrote a VS module, but that's a lot of work for something this minor.
Upvotes: 0