DEV Community


Box Comment plugin for VSCode

Matt Kenefick
Senior Engineer -- Learn to code first. Use libraries second.
・1 min read

Spent some time on Saturday playing with the VSCode plugin system. The documentation is great and it's worth looking into if you're tempted to make your own plugins.

A while ago, I created a quick prototype tool to format comments into clean ASCII boxes. I ended up using it a lot more than I thought I would, so I decided to turn it into a plugin for VSCode.


Box Comment


It generates a clean comment box using ascii box drawing characters around a selection.

# ┌──────────────────────────────────────────────────────┐
# │                                                      │
# │ This is a comment of documentation (Doc Block)       │
# │                                                      │
# │ @param Request $request                              │
# │ @return Response                                     │
# │ @throws \Exception                                   │
# │                                                      │
# └──────────────────────────────────────────────────────┘
Enter fullscreen mode Exit fullscreen mode


The plugin defaults to single line box drawing and 80 characters wide. You can change these in your settings:

"box-comment.chars": {
        "tl": "╔",
        "tm": "═",
        "tr": "╗",
        "l" : "║",
        "r" : "║",
        "bl": "╚",
        "bm": "═",
        "br": "╝",
        "dl": "╠",
        "dm": "═",
        "dr": "╣"
"box-comment.length": 80
Enter fullscreen mode Exit fullscreen mode



For Mac/PC: shift+cmd+; / shift+alt+; will run Create comment box (via config)


You can find it here.

Discussion (0)