Custom language braces alignment when returning an object

已回答

I am developing a plugin for IntelliJ IDEA which supports my custom Lua-based language formatting.

I expect to get following result

func () {
    //do something
    return {
        data = {
            v1 = "some value",
            v2 = 123
        }
    }
}

But I am getting this:

func () {
    //do something
    return {
            data = {
                       v1 = "some value",
                       v2 = 123
                   }
            }
}

The issue is that the closing braces after return statement are getting aligned with the opening. To align braces in a Java style I tried most obvious combinations of indents and wrappings but with no luck.

I have not implemented any Code Style Settings for my language but when debugging I see that CommonSettings contains HTML, XML, JAVA and JSON CommonCodeStyleSettings.

Cleaning up myCommonSettingsMap and myCustomSettingsMap in bebugger did not remedy the situation.

I assume some default settings are involved but I have no idea what to check. Could somebody help me?

1

Hi Stan,

It's hard to understand the issue and reason without the code. Could you please share it?

0

This post has helped me to identify the reason of my issue: when creating my formatting model blocks I always pass a default alignment: Alignment.createAlignment(). Passing null instead and providing alignment only when necessary was the solution to my problem!

0

请先登录再写评论。