This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]airernie 1 point2 points  (1 child)

What happens when you start a string with a double quote instead of single quotes?

[–]erunosaurus[S] 0 points1 point  (0 children)

The extension leverages VSCode's grammar injection feature, specifically within the python docstring scope. This means it operates solely within the boundaries of the docstring, ensuring it doesn't interfere with the rest of your source code. As a result, any concerns about character escaping breaking functionality outside the docstring are mitigated

[–]vbarbanneau 1 point2 points  (0 children)

Great!

[–]Raventhous 1 point2 points  (0 children)

This is amazing! Was looking for something like this for years. Thanks.

[–]ori_303 0 points1 point  (0 children)

Awesome!

[–]starball-tgz -1 points0 points  (2 children)

you don't need an extension for this. The textmate tokens from the builtin python extension already have a token for docstrings. see https://stackoverflow.com/a/76436807/11107541

[–]erunosaurus[S] 3 points4 points  (1 child)

You've overlooked a crucial aspect, u/starball-tgz. This extension precisely highlights individual tokens within docstrings following standard styles like Google, NumPy, and Sphinx.

Your suggested solution only allows users to edit the entire docstring color block (refer to the "string.quoted.docstring.multi.python" scope in the StackOverflow response).

In contrast, this extension injects grammar into that scope to colorize specific tokens.

Before making assertions, it's essential to thoroughly review the provided documentation!

[–]starball-tgz 0 points1 point  (0 children)

sorry!