Skip to content

Clang-format not following rule UseTab: Always #141129

Open
@kunalchandan

Description

@kunalchandan

Issue

First I would like to thank the authors of the tool. I have enjoyed using it and hope to continue using it.
If there is something I am doing incorrectly I would gladly be corrected.

I believe Clang-format is indenting with spaces when I want to only use tab indents.

Sample

#define FG_CYN	"\x1B[36m"
#define FG_WHT	"\x1B[37m"

#define RST	"\x1B[0m"

void fun_function(int param_a) {
	printf("I have a really long string here that exceeds my column limit");
	printf("I sometimes like" FG_CYN " to break with inserted defines" RST);
}

My minimal .clang-format

BasedOnStyle: GNU
Language: Cpp
ColumnLimit: 80

UseTab: Always
IndentWidth: 8
TabWidth: 8
ContinuationIndentWidth: 8

BreakStringLiterals: true

Output

#define FG_CYN	"\x1B[36m"
#define FG_WHT	"\x1B[37m"

#define RST	"\x1B[0m"

void fun_function(int param_a)
{
	printf("I have a really long string I's extra super long here that "
	       "exceeds my column limit");
	printf("I sometimes like colors and I insert them like this " FG_CYN
	       " to break with inserted defines" RST);
}

more clearly or in another way

void fun_function(int param_a)
{
\tprintf("I have a really long string I's extra super long here that "
\t\s\s\s\s\s\s\s\s"exceeds my column limit");
\tprintf("I sometimes like colors and I insert them like this " FG_CYN
\t\s\s\s\s\s\s\s\s" to break with inserted defines" RST);
}

I don't want to see \s or space characters used to indent, and only ever want to see \t or tabs as indents.

Thanks in advance :)

Other supporting system information

Using vscode.

$ clang-format --version
clang-format version 20.1.4

clang-format installed with python venv

Ubuntu 22.04

Python 3.10

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions