Skip to content

Does not generate doc string when another multi-line string exists in the function #311

Description

@pratik-mahamuni

Describe the bug
When writing database interaction functions, we write queries as multi-line variables:

def get_person_from_name(name: str) -> str:
    query = """
        SELECT name FROM person_table WHERE name=$1
    """
    # ... rest of the function

After writing the function definition with query as its first variable, typing """<Enter>, does not create the template.

Versions (please complete the following information):

  • autoDocstring Version: 0.6.1
  • Operating System: MacOS and Windows
  • Vscode Version: 1.108.1

Original Code (with line to generate on):

def get_person_from_name(name: str) -> str:
    # line to generate on
    query = """
        SELECT name FROM person_table WHERE name=$1
    """
    # ... rest of the function

Expected Result:

def get_person_from_name(name: str) -> str:
    """
    
    Args:
            name (str): 

    Returns:
           str: 
    """
    query = """
        SELECT name FROM person_table WHERE name=$1
    """
    # ... rest of the function

Actual Result:

def get_person_from_name(name: str) -> str:
    """
    """
    query = """
        SELECT name FROM person_table WHERE name=$1
    """
    # ... rest of the function

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

No logs emitted

Stack trace:
If an error was reported by autoDocstring please copy the stack trace from the autoDocstring output channel.

No error emitted

Additional context
None

Thank you for your work on this extension.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions