I created a language extension for Visual Studio Code and I would like to change the comment block characters, but I couldn't find a way to do so..
How can I do it?
I created a language extension for Visual Studio Code and I would like to change the comment block characters, but I couldn't find a way to do so..
How can I do it?
OK, I finally figured out what the problem was. There are two ways you can change the comment blocks:
I don’t know why it's not in the documentation (or at least I couldn't find it), but there is an optional property you pass to the object inside the contributes.languages
array in the package.json file named configuration.
The description found on the Visual Studio Code source code:
A relative path to a file containing configuration options for the language.
In those files you can create an object like this one and it's going to overwrite the default comment characters
{
"comments": {
"lineComment": "//",
"blockComment": [ "<!--", "-->" ]
}
}
You can see this properties on the API references: CommentRule
Note: That comment block command is triggered with a different shortcut. You can overwrite it though (in a general or even for a specific language using the property when
on the key binding object).
⇧⌥A - Toggle Block Comment - editor.action.blockComment
Key Bindings for Visual Studio Code
Yes, you can do it from there too and you can make it even better. You can see an example on vscode-handlebars/syntaxes/handlebars.tmLanguage.
Try deleting the Babel extension if you are using the Visual Studio Code editor. It worked for me.