As far as I can tell this is not currently available.
Oftentimes I need to comment out blocks of code and use /**
and immediately a */
auto inserted resulting in one extra step. Not a huge deal by any means, but it would be a nice added feature to be able to turn off auto-closures on comments. Or maybe even in the configs an array of chars not to close? If nobody else feels this way though, probably not worth the effort. I suppose I am looking for input on this feature.
We currently have editor.autoClosingBrackets
but this does take care of the comments
@variab1e When commenting out blocks of code, I personally always choose //
via Ctrl+/
. The reason I do it is that //
can comment out block comments and it is cumulative:
// /**
// * Returns the column for the text found at a specific offset inside a rendered dom node
// */
// getColumnOfNodeOffset(lineNumber:number, spanNode:HTMLElement, offset:number): number;
// // /**
// // * Let the line know that decorations might have changed
// // */
// // onModelDecorationsChanged(): void;
I am not sure why you choose to comment block of codes with /**
. Why not use /*
?
I think this is annoying behaviour too
Me too. Doesn't seem too hard to fix.
Yup, I am also not thrilled with this would like a way to switch it off.
@alexandrudima You asked why someone would do that?
This came up for me recently as I was trying to find some problematic code. Basically doing bisection search commenting things out. I started by commenting out a huge region of code and then incrementally moving the start of the commented region down the file, but the auto inserted characters were a nuisance.
Definitely a +1 from me on making this configurable.
For me, this behaviour does more harm than good and is pretty annoying.
Thats would be great to turn off auto closing comments.
I am also very annoyed by this not being able to be disabled, any features that auto injects text into the editor should have an option to disable it, considering auto closing /**/
comments don't even preserve proper indentation.
Any news on this? It's really annoying
I see I'm not the only one checking this thread more than three years after it was opened. Any updates on this, MS? Should just be a simple "set this property to false" to not add the extra "*/"...
Adding my voice also here. Incredibly annoying that this cannot be disabled alone.
Aghghghg this is the worst
Try this:
Open the extensions directory
(\Microsoft VS Code\resources\app\extensions)
There open your languaje directory
(C# for example, \csharp)
Edit the language configuration file
(language-configuration.json)
From "autoClosingPairs" group delete the line for the comments:
{ "open": "/*", "close": " */", "notIn": ["string"] }
Save the file. It's worling for me.
@FereBlanco dude you're a lifesaver! This solution works!
@FereBlanco :+1:
For linux users, the file is here:
/usr/share/code/resources/app/extensions/csharp/language-configuration.json
Any news ?
OK we have a good workaround, OK VSCode is entirely free and dudes are making an amazing job, but come on, this kind of detail is the very basics of a programmer's life, it shouldn't have to be a hack to tweak this thing :)
Thanks @FereBlanco and @lonix1
@FereBlanco and others - There is one flaw in the workaround, which should be addresses at the same time as the original issue.
When typing /*
, all folded code below becomes unfolded... what a nuisance!
What I do, when I remember to, is to first type */
below the code I want to comment, and then type /*
above that code block. Then the folding doesn't change.
Has anyone found a workaround for this?
Unless I'm missing something, the behavior introduced in #73841 can not be undone via configuration.
This is something I find very annoying and rather important to be addressed: this kind of automation is really in a way.
Spent some time this evening getting project compiled and hacked it a little bit. Ended up with this WIP code. It's a so called seems-to-work-for-me state of change. Close to be a proof-of-concept.
Would really be cool if such option is implemented in an official VS Code. I don't mind spending time on wrapping it up, but need input from more experienced VS Code developer about overall design and approach. Not sure if pull-request will be a way to go about it?
I find this behavior quite annoying too, especially because it currently seems to break automatic generation of doxygen comments via extensions.
@HDHarry, if it breaks functionality, is probably better to submit a bug report. Such things are very easy to get lost between cracks in the feature-request type of an issue.
At the meantime cleaned up the branch a bit and created #75053.
Thanks for the hint! I do not have time right now to take care of it, but will do so later.
Could somebody just fix this already please? It is extremely annoying, having to type "/*" with the key sequence [/
*
DEL
DEL
DEL
].
Also, for the future I would recommend implementing the rule that all newly added auto-closing features need to ...
After all, in software engineering projects, adding new features that change the behavior in a way that requires adaption from the user (as is clearly the case here) should be avoided if possible and should only happen during mayor releases.
+1, completely agree with all comments here. Clearly this only covers some use cases and breaks others. At least this should be configurable without having to manually edit the language configuration file. As others, I would be very happy if it was disabled by default.
Seems to have been fixed in the latest release (1.37.1).
@MulattoKid Please tell us which config option has been added for this. I looked and found nothing.
@MulattoKid Please tell us which config option has been added for this. I looked and found nothing.
So I recently did a fresh VSCode install on Ubuntu 18.04.02. At the time (August 1st), update 1.36.1 was the most recent one. I then immediately updated my settings.json file to be:
{
"workbench.colorTheme": "Visual Studio Light",
"editor.autoClosingBrackets": "never",
"editor.autoClosingQuotes": "never",
"editor.autoIndent": false,
"editor.acceptSuggestionOnCommitCharacter": false,
"editor.acceptSuggestionOnEnter": "off",
"editor.snippetSuggestions": "none",
"editor.suggest.filterGraceful": false,
"files.maxMemoryForLargeFilesMB": 8192,
"editor.wordBasedSuggestions": false
}
I quickly noticed that upon entering /*
in C++ files, the comment was closed on the same line with */
(which I had never experienced before - I had an old version before the fresh install).
Then, without changing the settings.json file, I downloaded the newest update, 1.37.1, today and the problem disappeared. That's why I thought it had been fixed, but maybe I'm wrong...?
Edit: also, downgrading brings the issue back.
Most helpful comment
Try this:
Open the extensions directory
(\Microsoft VS Code\resources\app\extensions)
There open your languaje directory
(C# for example, \csharp)
Edit the language configuration file
(language-configuration.json)
From "autoClosingPairs" group delete the line for the comments:
{ "open": "/*", "close": " */", "notIn": ["string"] }
Save the file. It's worling for me.