autoDocstring
autoDocstring copied to clipboard
Templates using CRLF newlines cause extra returns and white spaces
Describe the bug
When a custom template is using CRLF newlines (typical in Windows), the generated docstring would contain extra line returns and trailing white spaces.
I copied the exact google template from the source as a custom template. When I saved the template file with LF newlines, the behavior was expected. When the template was saved with CRLF, the output is what's below.
Versions (please complete the following information):
- autoDocstring Version: v0.5.4
- Operating System: Windows 11
- Vscode Version: 1.59.1
Original Code (with line to generate on):
def foo(param1, param2: str, param3: Optional[str]=None):
# generate on this line
pass
Expected Result:
def foo(param1, param2: str, param3: Optional[str]=None) -> str:
"""[summary]
Args:
param1 ([type]): [description]
param2 (str): [description]
param3 (Optional[str], optional): [description]. Defaults to None.
Returns:
str: [description]
"""
pass
Actual Result:
def foo(param1, param2: str, param3: Optional[str]=None) -> str:
"""[summary]
Args:
param1 ([type]): [description]
param2 (str): [description]
param3 (Optional[str], optional): [description]. Defaults to None.
Returns:
str: [description]
"""
pass
Note the trailing white spaces in the new lines.
Stack trace:
If an error was reported by autodocstring please copy the stack trace from the autoDocstring output channel.
N/A
Additional context Add any other context about the problem here.