Page 1 of 1

Disable autoclose brackets and comments (clang)

Posted: Tue Sep 02, 2025 11:15 am
by martins
Does anyone know how to configure the clang so it does NOT autoclose my brackets and comments? Its super annoying.

Ideally I would like to autoclose only the `{ }` brackets in the way the old Eclipse editor did it: type `{`, press ENTER and the closing bracket is added with corect indentation.

None of it works now. VSCode somehow seems to at least keep the indentation a bit better, Eclipse is a mess right now.

Re: Disable autoclose brackets and comments (clang)

Posted: Wed Sep 03, 2025 1:20 pm
by kondalkolipaka
Hello,

You can customize this in the Language Configuration preferences.
Screenshot 2025-09-03 at 6.48.54 PM.png
Screenshot 2025-09-03 at 6.48.54 PM.png (1.75 MiB) Viewed 8326 times

Re: Disable autoclose brackets and comments (clang)

Posted: Thu Sep 04, 2025 10:18 am
by martins
@kondalkolipaka There it is, thank you very much!

I also see there are some indentation rules which could possibly do what I want, just no Idea how to edit those. Ideally regardless of the language used.

Re: Disable autoclose brackets and comments (clang)

Posted: Thu Sep 04, 2025 6:45 pm
by kondalkolipaka
To customize the indentation rules or add new ones, download the language configuration from here:

https://github.com/eclipse-tm4e/tm4e/bl ... ation.json

Modify it as needed.

Then, use the Add… button from the Language Configuration Preferences window.

Re: Disable autoclose brackets and comments (clang)

Posted: Fri Sep 05, 2025 6:00 am
by martins
Thats the template I was looking for, TYWM!

Re: Disable autoclose brackets and comments (clang)

Posted: Fri Sep 05, 2025 7:16 am
by martins
Ok I just can't get the Textmate to indent at all. Tried adding some example indent rules, tried creating new workspace with example project, but when I press enter the cusror just goes to beginning of the line, no indentation, pretty much regardless of the settings. This should not be this hard.

Edit: Ok, a tiny improvement showing that something might be happening: first add DisableFormat: true to .clang-format. Then I have to add my custom rules as "C Source File", cant replace the original "C" rules. In this case there is some indentation happening, but only on each 2nd ENTER press. Results in one line not indented and one indented, alternating all the time.

I have added example rules from here: https://macromates.com/manual/en/appendix, specifically these:

Code: Select all

"indentNextLinePattern": {
	"pattern": "^(?!.*;\\s*//).*[^\\s;{}]\\s*$"
},
"unIndentedLinePattern": {
	"pattern": "^\\s*((/\\*|\\*/\\s*$|//|#|@interface|@implementation|@end).*)?$"
}