vscode-clang-format icon indicating copy to clipboard operation
vscode-clang-format copied to clipboard

Number of spaces for indent [cpp]

Open mnissov opened this issue 4 years ago • 3 comments

Is it possible to have the formatter follower the indent size specified in the settings.json for a given file? Or is there a way to globally make the indent size 4 spaces instead of two?

mnissov avatar Jul 11 '20 17:07 mnissov

Currently it follows the indent size in the .clang-format configuration file only. So you can put

---
IndentWidth: 4
TabWidth: 4
UseTab: Never
---

in your .clang-format file. I'm going to look into an option to automatically use the editor settings when I have some time available. I'm also willing to merge patches that address that issue.

xaverh avatar Jul 14 '20 12:07 xaverh

Where is the .clang-format file located?

kaustubhcs avatar May 23 '21 21:05 kaustubhcs

Figured out. Just created a .clang-format file in workspace directory.

kaustubhcs avatar May 23 '21 22:05 kaustubhcs