Skip to content

generateDocstringOnEnter does not appear to work #312

@a-macgillivray-fnc

Description

@a-macgillivray-fnc

Describe the bug
The setting autoDocString.generateDocstringOnEnter does not appear to do anything.

Versions (please complete the following information):

  • autoDocstring Version: 0.6.1
  • Operating System: Windows
  • Vscode Version: 1.109.5

Original Code (with line to generate on):

My settings.json file:

{
  "[python]": {
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
      "source.fixAll": "explicit",
      "source.organizeImports": "explicit"
    },
    "editor.defaultFormatter": "charliermarsh.ruff"
  },
  "python-envs.defaultEnvManager": "ms-python.python:conda",
  "python-envs.defaultPackageManager": "ms-python.python:conda",
  "autoDocstring.docstringFormat": "sphinx",
  "autoDocstring.generateDocstringOnEnter": false,
  "autoDocstring.startOnNewLine": true
}
class Settings(BaseSettings):
"""<enter hit here># expected not to generate on this line

Expected Result:

class Settings(BaseSettings):
    """
    <cursor moves down without a docstring generating>

Actual Result:

class Settings(BaseSettings):
    """
    _summary_

    :param BaseSettings: _description_
    :type BaseSettings: _type_
    :raises ValueError: _description_
    :raises ValueError: _description_
    :raises ValueError: _description_
    :return: _description_
    :rtype: _type_
    """

Debug log:
Set autoDocstring.logLevel to "Debug", recreate the bug, and then copy the debug logs from the autoDocstring output channel.

[INFO 10:31:52.047] Successfully inserted docstring
[INFO 10:34:07.334] Generating Docstring at line: 8
[INFO 10:34:07.335] Docstring generated:
    """
    ${1:_summary_}

    :param BaseSettings: ${2:_description_}
    :type BaseSettings: ${3:_type_}
    :raises ValueError: ${4:_description_}
    :raises ValueError: ${5:_description_}
    :raises ValueError: ${6:_description_}
    :return: ${7:_description_}
    :rtype: ${8:_type_}
    """
[INFO 10:34:07.335] Inserting at position: 8 0
[INFO 10:34:07.346] Successfully inserted docstring

Additional context
I gave a quick search over the repo with github - it doesn't appear that the generateDocStringOnEnter setting is actually used anywhere. It comes up in one test, the package.json, and the README, and that's it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions