lua-language-server icon indicating copy to clipboard operation
lua-language-server copied to clipboard

Unable to turn off continuous align

Open KayleMaster opened this issue 1 year ago • 4 comments

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Formatting

Expected Behaviour

local buildings = {
    {button = granaryButton, name = "Granary", description = "\nIncreases food capacity."},
    {button = appleFarmButton, name = "Orchard", description = "\nProduces apples."},
    {button = wheatFarmButton, name = "WheatFarm", description = "\nProduces wheat which can be processed into flour."},
    {button = hopsFarmButton, name = "HopsFarm", description = "\nProduces hops which can be processed into ale."}
}

Actual Behaviour

local buildings = {
    { button = granaryButton,   name = "Granary",   description = "\nIncreases food capacity." },
    { button = appleFarmButton, name = "Orchard",   description = "\nProduces apples." },
    { button = wheatFarmButton, name = "WheatFarm", description = "\nProduces wheat which can be processed into flour." },
    { button = hopsFarmButton,  name = "HopsFarm",  description = "\nProduces hops which can be processed into ale." }
}

Reproduction steps

  1. Have this .editorconfig in root:
root = true

[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.lua]
keep_one_space_between_table_and_bracket = false
align_continuous_assign_statement = false
align_continuous_rect_table_field = false
continuation_indent = 0
max_line_length = 200
  1. Format a file
  2. Editorconfig is ignored completely, as well as default options set through vscode UI

Additional Notes

I have the Editorconfig extension loaded. I tried adding the setting inside VSCode UI for lua sumneko as well. To no avail.

Log File

No response

KayleMaster avatar Mar 14 '23 21:03 KayleMaster

please see https://github.com/CppCXY/EmmyLuaCodeStyle/blob/master/lua.template.editorconfig the names of many options have changed, and many new options have been added. your question is set align_array_table=false

CppCXY avatar Mar 15 '23 02:03 CppCXY

@CppCXY I just tried the suggest option but behavior wise nothing changed. Still behaves as @KayleMaster described above.

MarcoBuess avatar Jan 14 '24 20:01 MarcoBuess

Aight. So the situation is that I'm providing the arguments directly through nvim-lspconfig rather that .editorconfig. It can't handle the value passed als lua bool. You will have to provide "false" like so (if that correlates to your issue):

Lua = {
    . . .
    format = {
        enable = true,
        defaultConfig = {
            indent_style = "space",
            indent_size = "4",
            quote_style = "double",
            align_array_table = "false",
        },
    },
},

MarcoBuess avatar Jan 14 '24 20:01 MarcoBuess

Aight. So the situation is that I'm providing the arguments directly through nvim-lspconfig rather that .editorconfig. It can't handle the value passed als lua bool. You will have to provide "false" like so (if that correlates to your issue):

Lua = {
    . . .
    format = {
        enable = true,
        defaultConfig = {
            indent_style = "space",
            indent_size = "4",
            quote_style = "double",
            align_array_table = "false",
        },
    },
},

image

I don't have neovim., so I tested it on vscode and it's basically right. maybe you already have a .editorconfig file in your workspace, so it won't use the default configuration.

CppCXY avatar Jan 15 '24 03:01 CppCXY