autoDocstring
autoDocstring copied to clipboard
Trailing whitespaces
Describe the bug When I generate a Google Style Docstring inside a function there are four trailing whitespaces after the three closing quotes, here they are marked with asterisks:
"""
Read a file with names and messages and return it as a list
Args:
file_path (str): File to open
Returns:
list: List with tuples made of name + message
"""****
Versions:
- autoDocstring Version: v0.5.3
- Operating System: Microsoft Windows 10 Home v. 2004
- Vscode Version: 1.50.0
Just for information, this does not happen to me, and we have almost
- autoDocstring version: 0.5.3
- Operating system: Windows 10 Pro for workstations
- Vscode Version 1.50.1
Maybe you can share the exact function before using the autodocstring, I show mine.
Before:
def func(a, b):
raise NotImplementedError
After:
def func(a, b):
"""[summary]
Args:
a ([type]): [description]
b ([type]): [description]
Raises:
NotImplementedError: [description]
"""
raise NotImplementedError
I tried with another function, before:
def from_xyLabyrinth_to_xyMath(position_xLabyrinth, position_yLabyrinth):
position_xMath = position_xLabyrinth + 1
position_yMath = 10 - position_yLabyrinth
return (position_xMath, position_yMath)
after:
def from_xyLabyrinth_to_xyMath(position_xLabyrinth, position_yLabyrinth):
"""
[summary]
Args:
position_xLabyrinth ([type]): [description]
position_yLabyrinth ([type]): [description]
Returns:
[type]: [description]
"""
position_xMath = position_xLabyrinth + 1
position_yMath = 10 - position_yLabyrinth
return (position_xMath, position_yMath)
but the problem remains.
To insert the docstring I created a new line after the def function_name line, pressed ctrl+shift+p and selected Generate Docstring.
Versions: autoDocstring Version: v0.5.3 Operating System: Microsoft Windows 10 Home v. 20H2 Vscode Version: 1.50.1
I have the same issue and I discovered that if my cursor is already indented when clicking cmd+shift+2
, it will add the trailing whitespaces. If the cursor is not indented, it doesn't add them. Hopefully this is helpful until a fix is added.
+1, please fix
Oh I understand the problem. It has never happened for me because I have the files.trimTrailingWhitespace
vscode setting that will always remove trailing whitespace before I run the command. I can fix this but I also recommend turning on that setting. It's really useful.
I am also sometimes experiencing this. Using google style docstrings. Can't tell by now when exactly it happens.