Disable autoclose brackets and comments (clang)

martins
Posts: 72
Joined: Tue Aug 24, 2021 8:58 am

Disable autoclose brackets and comments (clang)

Postby martins » Tue Sep 02, 2025 11:15 am

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.

kondalkolipaka
Espressif staff
Espressif staff
Posts: 269
Joined: Wed Jul 17, 2019 5:26 pm

Re: Disable autoclose brackets and comments (clang)

Postby kondalkolipaka » Wed Sep 03, 2025 1:20 pm

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 8324 times

martins
Posts: 72
Joined: Tue Aug 24, 2021 8:58 am

Re: Disable autoclose brackets and comments (clang)

Postby martins » Thu Sep 04, 2025 10:18 am

@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.

kondalkolipaka
Espressif staff
Espressif staff
Posts: 269
Joined: Wed Jul 17, 2019 5:26 pm

Re: Disable autoclose brackets and comments (clang)

Postby kondalkolipaka » Thu Sep 04, 2025 6:45 pm

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.

martins
Posts: 72
Joined: Tue Aug 24, 2021 8:58 am

Re: Disable autoclose brackets and comments (clang)

Postby martins » Fri Sep 05, 2025 6:00 am

Thats the template I was looking for, TYWM!

martins
Posts: 72
Joined: Tue Aug 24, 2021 8:58 am

Re: Disable autoclose brackets and comments (clang)

Postby martins » Fri Sep 05, 2025 7:16 am

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).*)?$"
}

Who is online

Users browsing this forum: Qwantbot and 0 guests