Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to comment out code in VS Code without indent?

Currently, after commenting out the code (e.g. in BASH script) in VS Code I get:

function foo {

    #function bar {
    #    echo 'Le Bar.';
    #}
}

but I'd like to have this:

function foo {

#    function bar {
#        echo 'Le Bar.';
#    }
}

I can't find proper settings for disabling comment indentation, what am I missing?

Edit: I created Feature Request for it, please upvote, if you're also interested in having it here: https://github.com/microsoft/vscode/issues/147168 — just 20 upvotes will move the request to backlog. :-)

Edit: "Just" 15 votes more and we gonna have it! (Well, almost) :-) Please be so kind to upvote! :-)

Edit: Just 2 votes more! :-) Speak up! Don't be shy! :-)

like image 874
Cromax Avatar asked Apr 17 '26 23:04

Cromax


1 Answers

There are no features built into Visual Studio Code for not indenting comments.

However, if you really want to have them, you could follow these two links to other Stack Overflow answers (but it might just be overkill):

  • VSCode Preserve Indentation when Commenting out Lines
  • Make Comments of VSCode Start at Column Position 0

You can also make a GitHub Issue on Microsoft's official Visual Studio Code repository with the tag feature-request.


In summary, there isn't a feature like that in Visual Studio Code. However, there are a few solutions, but they just might be overkill for such a simple task.

like image 190
Viradex Avatar answered Apr 21 '26 03:04

Viradex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!