Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: editor.autoCloseBlockComment setting #154994

Open
Colengms opened this issue Jul 12, 2022 · 6 comments
Open

Feature Request: editor.autoCloseBlockComment setting #154994

Colengms opened this issue Jul 12, 2022 · 6 comments
Assignees
Labels
editor-autoclosing Editor automatic closing of parens / brackets / etc. feature-request Request for new features or functionality
Milestone

Comments

@Colengms
Copy link
Contributor

In 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: #54499 ).

#1966 is related.

@hediet
Copy link
Member

hediet commented Jul 14, 2022

duplicate of #102574

@hediet hediet closed this as completed Jul 14, 2022
@Colengms
Copy link
Contributor Author

Just in case this was duplicated by mistake: The ask here is for an additional setting (more granularity), to allow auto-closing of block comments to be configured separately from auto closing of brackets. That does not appear to be discussed in #102574 .

@hediet hediet reopened this Jul 14, 2022
@hediet hediet added feature-request Request for new features or functionality editor-autoclosing Editor automatic closing of parens / brackets / etc. labels Jul 14, 2022
@hediet hediet added this to the Backlog milestone Jul 14, 2022
@hediet
Copy link
Member

hediet commented Jul 14, 2022

I'm not (yet) very familiar with the auto-closing logic. What is the advantage of using autoCloseBlockComment over autoClosingBrackets?

@Colengms
Copy link
Contributor Author

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.

@aeschli
Copy link
Contributor

aeschli commented Sep 8, 2022

Ideally the user could individually define auto closing pairs.
Something like:

editor.autoClosingPairs: {
  "{ }": true
  "[ ]": false
  "/* */": true
}
  • the first space character separates open from the close token (allowing spaces in the close token)
  • language specific conf would be possible with the usual syntax [java]
  • using an object allows to add / remove single pairs to the ones defined in the language config
  • I'd start without the notIn. If really needed, this could be done with an object instead of true/false
editor.autoClosingPairs: {
  "/* */": { 
     strings: false
  }
}

@happyTonakai
Copy link

Any updates? I really need an autoclosing for /* */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-autoclosing Editor automatic closing of parens / brackets / etc. feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

6 participants