arduino – VS code how to customize the formatting of .ino files


I installed a Microsoft plugin for arduino development in Visual studio code, but when auto-formatting, when you press ctrl+shift+i editor wraps the curly brace to the next line, for example, when declaring a procedure and not only:

void setup

but I would like this:

void setup {

How to fix?


Install clang-format.

Install the VSCode Clang-format plugin.

In settings.json specify the setting

"clang-format.executable": "clang-format", // или путь до clang-format

In the root folder of the project, create a .clang-format file for example with the content:

  AfterClass:      true
  AfterControlStatement: true
  AfterEnum:       true/false
  AfterFunction:   true
  AfterNamespace:  true/false
  AfterObjCDeclaration: true/false
  AfterStruct:     true/false
  AfterUnion:      true/false
  BeforeCatch:     true/false
  BeforeElse:      true/false
  IndentBraces:    true/false
BreakBeforeBraces: Custom


Clang-format documentation:


.Clang-format config creation interactively:

Scroll to Top