Sublime Forum

Plugin to format class/struct names and typedefs in C/C++?

#1

Basically, I’m looking for some plugin or feature that will take this…

[code]struct SomeStruct
{
int32_t Foo;
int32_t Bar;
};

static SomeStruct SomeFunction()
{
SomeStruct Result = {};
Result.Bar++;
Result.Foo++;
return Result;
}[/code]

read the line “struct SomeStruct”, recognize from that line that “SomeStruct” is now a struct that it should format, and then format that string across the rest of the document, outputting something like this:

struct SomeStruct
{
int32_t Foo;
int32_t Bar;
};

static SomeStruct SomeFunction()
{
SomeStruct Result = {};
Result.Bar++;
Result.Foo++;
return Result;
}

Could something like that be done for typedefs as well…?

0 Likes

#2

The Clang Format package may do what you want - it has a ton of flags for formatting code the way you specify.

0 Likes

#3

I think what he/she wants is a static C++ code analyzer and use the result to apply a new C++ syntax highlight dynamically…

1 Like