1

Consider this Python class with docstring:

class TestClass:
    '''
    Summary line of docstring

    Additional lines of docstring.

    Attributes:
        attr1 (int): this is the desc of a public attribute
        attr2 (bool): another desc for a second attribute

    Methods:
        calculate
        calculate()
        calculate(int)

    '''

I used the Google style format for docstrings, with Attributes and Methods sections.

But, in Visual Studio Code, when hovering the class name, the docstring is rendered that way: docstring rendering in VSCode

So, the Attributes section header is recognized and its elements are highlighted; but, the Methods section header isn't. Testing with a method docstring, all section headers I know (Args, Returns, Raises) are also recognized and highlighted.

So, is there anything I can do with VSCode for Methods header to be recognized and highlighted in the docstring rendering view? maybe I'm using the wrong header?

1
  • 3
    For starters, the Google style guide doesn't describe a docstring section named "Methods". Commented May 30 at 15:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.