-
-
修改
.mustache
模板文件如下,记住该模板文件的位置
,后续设置需要设置该模板的路径 -
注意
:删除第3行,第6行的空行,可以减少插入模板中的间距!
{
{! Google Docstring Template }}
{
{summaryPlaceholder}}
{
{extendedSummaryPlaceholder}}
{
{#parametersExist}}
Args:
{
{#args}}
- {
{var}} (``{
{typePlaceholder}}``): {
{descriptionPlaceholder}}
{
{/args}}
{
{#kwargs}}
{
{var}} ({
{typePlaceholder}}, optional): {
{descriptionPlaceholder}}. Defaults to {
{&default}}.
{
{/kwargs}}
{
{/parametersExist}}
{
{#exceptionsExist}}
Raises:
{
{#exceptions}}
{
{type}}: {
{descriptionPlaceholder}}
{
{/exceptions}}
{
{/exceptionsExist}}
{
{#returnsExist}}
Returns:
{
{#returns}}
- {
{typePlaceholder}} (``{
{typePlaceholder}}``): {
{descriptionPlaceholder}}
{
{/returns}}
{
{/returnsExist}}
{
{#yieldsExist}}
Yields:
{
{#yields}}
{
{typePlaceholder}}: {
{descriptionPlaceholder}}
{
{/yields}}
{
{/yieldsExist}}
- 修改路径
- 通过
Ctrl+,
打开设置面板 - 在搜索栏中搜索:
customTemplatePath
- 在
Auto Docstring: Custom Template Path
输入.mustache文件的绝对路径或相对路径
- 重启VSCode生效
- 通过