230612 - Customize AutoDocstring template styles in VSCode

  • AutoDocstring plug-in official website

  • google docstring template

  • Modify .mustachethe template file as follows, 记住该模板文件的位置, and follow-up settings need to set the path of the template

  • 注意: Delete the blank lines in the 3rd and 6th lines, which can reduce the spacing in the inserted template!

{
   
   {! 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}}
  • modify path
    • Ctrl+,Open the settings panel by
    • Search in the search bar for:customTemplatePath
    • in Auto Docstring: Custom Template Paththe input.mustache文件的绝对路径或相对路径
    • Restart VSCode to take effect

Guess you like

Origin blog.csdn.net/qq_33039859/article/details/131167498