Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to the Power Users community on Codidact!

Power Users is a Q&A site for questions about the usage of computer software and hardware. We are still a small site and would like to grow, so please consider joining our community. We are looking forward to your questions and answers; they are the building blocks of a repository of knowledge we are building together.

How to change default comment char for INI in VS Code?

+3
−0

When I set a file's language as "INI" in VS Code, and use the "comment" command, it uses ; as the comment character. Is there a way to make it use # instead?

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

1 answer

+2
−0

You can't edit it in settings, but I do know where those come from. It's in language-configuration.json, under comments:

Comment toggling

VS Code offers two commands for comment toggling. Toggle Line Comment and Toggle Block Comment. You can specify comments.blockComment and comments.lineComment to control how VS Code should comment out lines / blocks.

{
  "comments": {
    "lineComment": "//",
    "blockComment": ["/*", "*/"]
  }
}

Worst case, you may be able to modify the source of the package. VSC doesn't have options for tweaking those as part of its core. However, since other people also have this need, Arturo Dent made a package to maintain the package tweaks I suggested above.

For example, if you prefer your line comments to look like // * you can set it to that in specific languages. Here is an example setting in user settings.json:

"custom-language-properties": {
  "javascript.comments.lineComment": "// *",
  "python.comments.lineComment": "# *",
  "python.brackets": [["{","}"],["[","]"],["(",")"]]
}

These are NOT additional comment styles, the default comment styles will be replaced by those in your setting. I suggest you do not go crazy with comment style for example, as other editors may not recognize them as comments. So something like // ** is fine (the leading // will still be recognized as a comment) but ** by itself will not be recognized by another editor or person without this extension and that setting.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »