Search code examples
pythonpython-3.xvisual-studio-codecommentsedit

Create a column comment in python source file


Hello I want to create a comment section right next to all my code lines for documentation purposes. I have over 1000 lines of code and I don't want to place all the # by myself.

The result I want to achieve:

    code()              # comment
    code()              # comment
    code()              # comment
    code()              # comment

Is there a way to do this automaticly?


Solution

  • There are a number of extensions that do this well. See, e.g., Simple Alignment. Just select the characters you want to align.

    betterAlign

    You can bind the Align command to a keybinding if you want.

    {
      "key": "alt+a",
      "command": "simple-alignment.align"
    },