Automatically generate docstrings using ChatGPT.
Install it from Visual Studio Marketplace or download and install .vsix file from Releases.
Type """
and select Generate Docstring (ChatGPT)
from the completion items.
Right click in the Text Editor area and select Generate Docstring (ChatGPT)
.
Open the Command Palette (F1), type docstring
and select Generate Docstring (ChatGPT)
.
Use the following keyboard shortcut:
Ctrl+Alt+D
Cmd+Opt+D
You can change the default keyboard shortcut by Keyboard Shortcuts editor (File > Preferences > Keyboard Shortcuts).
To use the extension, you will need an OpenAI API key. To obtain one, follow these steps:
You can change the API key using the
Set OpenAI API key
command in the Command Palette (F1).
chatgpt-docstrings.interpreter
: When set to a path to python executable, extension will use that to launch the server and any subprocess.
chatgpt-docstrings.openaiModel
: Which OpenAI model to use.
chatgpt-docstrings.docstringFormat
: Which docstring format to use.
chatgpt-docstrings.onNewLine
: Start docstring on new line.
Option ignored for one-line docstring
chatgpt-docstrings.promptPattern
: ChatGPT prompt to generate docstring.
The expression
{docstring_format}
used in the prompt will be replaced with the value of the parameterchatgpt-docstrings.docstringFormat
,{function}
— with the source code of the function for which the docstring will be generated.
chatgpt-docstrings.responseTimeout
: ChatGPT response timeout in seconds.
chatgpt-docstrings.showProgressNotification
: Show progress notification of docstring generation.
This extension collects anonymous information related to the usage of the extension, such as well as performance and error data. You can disable telemetry as described here.
See Change Log here
Submit the issues if you find any bug or have any suggestion.
Fork the repo and submit pull requests.
This extension is licensed under the MIT License