Feature Request: `editor.autoCloseBlockComment` setting
See original GitHub issueIn language-configuration.json
, block comment start and end positions can be defined. For example, for cpp, or typescript-basics:
"blockComment":["/*","*/"]
typescript-basics also has an AutoClosingPair defined for block comments (requiring an additional asterisk, though I’m not aware of the origin of that convention) :
{
"open": "/**",
"close": " */",
"notIn": [
"string"
]
}
There are currently two settings, which make it possible to disable the auto-closing, for brackets and quotes: editor.autoClosingBrackets
and editor.autoClosingQuotes
.
It looks like editor.autoClosingBrackets
also controls whether comments are auto-closed. Since there are fields in language-configuration.json
to identify brackets and blockComments, it seems enabling/disabling of block comments could be done using a separate setting, rather than being lumped in with brackets.
There is not currently an autoClosingPair
in cpp
. I’d also like to suggest adding that, provided there is a way to disable it without disabling auto closing of brackets.
Alternatively, if there is a recommended way of implementing auto-closing of block comments that could be implemented by an extension, perhaps we could do that in the C/C++ extension and provide our own setting for it.
Ideally, C++ block comment closing would not require the second asterisks (required in typescript* and the closing */
could be typed over. (see: https://github.com/microsoft/vscode/issues/54499 ).
https://github.com/microsoft/vscode/issues/1966 is related.
Issue Analytics
- State:
- Created a year ago
- Reactions:5
- Comments:6 (5 by maintainers)
Top GitHub Comments
Hi @hediet . The advantage of adding a new
autoCloseBlockComment
setting would just be to allow the user to separately enable/disable auto-closing of comments, such as :/*
->/**/
… without having to alter whether auto-closing of brackets is enabled/disabled (w/
autoClosingBrackets
) :[
->[]
(
->()
There are already separate settings for enabling/disabling auto-closing of brackets vs. quotes. I’m just requesting that auto-closing of comments should have its own setting, instead of being controlled by the same setting that control auto-closing of brackets. (I pointed out in the original post that there is already sufficient information to separately identify which entries in the
autoClosingPairs
list are comments.)We’re considering adding auto-closing support for block comments in the C/C++ Extension. That is not currently configured in the built-in
cpp
language extension. If we add it there, it would be nice to be able to enable/disable it independently.Any updates? I really need an autoclosing for
/* */