Skip to content

Looking for a Python extension for auto-generated comment header #226

Discussion options

You must be logged in to vote

Ohh I see. I'm wondering if you could use snippets for this? If you run the "Snippets: Configure User Snippets" command, you could create one for Python only that could do something like this:

  "Add comments to functions": {
    "prefix": "def",
    "body": [
      "# -------------------------------------",
      "# $1 ",
      "# -------------------------------------",
      "def $2"
    ],
    "description": "Add comments to functions"
  }

This would make it VS Code suggest the snippet once you start typing "def", and then if you accept it, it will add the comments above it. You can play around with the $N markers to enable which input you want to fill in first. This way you can just …

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by isidorn
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants